Class: LesliShield::DeviseMailer
- Inherits:
-
Lesli::ApplicationLesliMailer
- Object
- Lesli::ApplicationLesliMailer
- LesliShield::DeviseMailer
- Defined in:
- app/mailers/lesli_shield/devise_mailer.rb
Instance Method Summary collapse
-
#confirmation_instructions(user, token, opts = {}) ⇒ Object
Sends an email to allow the user confirm the email address.
-
#reset_password_instructions(user, token, opts = {}) ⇒ Object
Sends an email with instructions to allow the user reset the password.
- #welcome(user) ⇒ Object
Instance Method Details
#confirmation_instructions(user, token, opts = {}) ⇒ Object
Sends an email to allow the user confirm the email address
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/mailers/lesli_shield/devise_mailer.rb', line 58 def confirmation_instructions(user, token, opts = {}) # defaults for new accounts/users email_template = "devise/confirmation_instructions" email_subject = I18n.t("core.users/confirmations.mailer_email_verification") # # custom email and subject if user is changin his email address # if !record.unconfirmed_email.blank? # email_template = "update_email_confirmation_instructions" # email_subject = I18n.t("core.users/confirmations.mailer_confirmation_instructions_subject") # end # Depending on wheter there is a new user or they are changing their email, # one or another field will be used email_recipient = user.unconfirmed_email || user.email # email parameters params = { url: build_url("/confirmation", { confirmation_token: token}) } # send email email( params, to: email_recipient, subject: email_subject, template_name: email_template ) end |
#reset_password_instructions(user, token, opts = {}) ⇒ Object
Sends an email with instructions to allow the user reset the password
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/mailers/lesli_shield/devise_mailer.rb', line 36 def reset_password_instructions(user, token, opts = {}) # defaults for new accounts/users email_template = "devise/reset_password_instructions" email_subject = I18n.t("core.users/confirmations.mailer_email_verification") # email parameters params = { url: build_url("/password/edit", { reset_password_token: token}), full_name: user.full_name } # send email email( params, to: user.email, subject: email_subject, template_name: email_template ) end |
#welcome(user) ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'app/mailers/lesli_shield/devise_mailer.rb', line 88 def welcome(user) email_recipient = user.unconfirmed_email || user.email email( { :user => user }, to: email_recipient, subject: "test", template_name: "devise/welcome" ) end |