Class: PasswordMailer

Inherits:
ActionMailer::Base
  • Object
show all
Includes:
Login::MailConfig
Defined in:
app/models/password_mailer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handle_user_password_reset_requested!(event) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/models/password_mailer.rb', line 7

def handle_user_password_reset_requested!(event)
  reset_password_email(
    :user => event.object, 
    :from => site(event.source.site).email_from,
    :reset_link => password_reset_link(event.source, event.token), 
    :token => event.token
  ).deliver_now
end

.handle_user_password_updated!(event) ⇒ Object



16
17
18
19
20
21
# File 'app/models/password_mailer.rb', line 16

def handle_user_password_updated!(event)
  updated_password_email(
    :user => event.object, 
    :from => site(event.source.site).email_from
  ).deliver_now
end

Instance Method Details

#reset_password_email(attributes = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'app/models/password_mailer.rb', line 30

def reset_password_email(attributes = {})
  @user = attributes[:user]
  @reset_link = attributes[:reset_link]
  @token = attributes[:token]
  mail({
    to: attributes[:user].email,
    from: attributes[:from],
    subject: I18n.t(:'adva.passwords.notifications.reset_password.subject'),
  })
end

#updated_password_email(attributes = {}) ⇒ Object



41
42
43
44
45
46
47
48
# File 'app/models/password_mailer.rb', line 41

def updated_password_email(attributes = {})
  @user = attributes[:user]
  mail({
    to: attributes[:user].email,
    from: attributes[:from],
    subject: I18n.t(:'adva.passwords.notifications.password_updated.subject'),
  })
end