Method: SmtpConfiguration#update_token

Defined in:
lib/app/models/smtp_configuration.rb

#update_tokenObject

Update the token on save if we are active and the token is not already set.



64
65
66
67
68
69
70
71
72
# File 'lib/app/models/smtp_configuration.rb', line 64

def update_token
  if active?
    set(confirmation_token: Digest::SHA256.hexdigest("#{id}_#{.id}")) if confirmation_token.nil?
    set(confirmed: false)
    set(verification_message: 'Sending SMTP verification email(s) to SMTP admins.')
  else
    set(verification_message: 'SMTP Configuration is not active, no verification email will be sent.')
  end
end