Class: Decidim::DecidimDeviseMailer
- Inherits:
-
Devise::Mailer
- Object
- Devise::Mailer
- Decidim::DecidimDeviseMailer
- Includes:
- LocalisedMailer, SanitizeHelper
- Defined in:
- app/mailers/decidim/decidim_devise_mailer.rb
Overview
A custom mailer for Devise so we can tweak the invitation instructions for each role and use a localised version.
Instance Method Summary collapse
-
#invitation_instructions(user, token, opts = {}) ⇒ Object
Sends an email with the invitation instructions to a new user.
Methods included from SanitizeHelper
#decidim_escape_translated, #decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included
Instance Method Details
#invitation_instructions(user, token, opts = {}) ⇒ Object
Sends an email with the invitation instructions to a new user.
user - The User that has been invited. token - The String to be sent as a token to verify the invitation. opts - A Hash with options to send the email (optional).
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/mailers/decidim/decidim_devise_mailer.rb', line 18 def invitation_instructions(user, token, opts = {}) with_user(user) do @token = token @organization = user.organization @opts = opts if opts[:invitation_instructions] opts[:subject] = I18n.t("devise.mailer.#{opts[:invitation_instructions]}.subject", organization: organization_name(user.organization)) end end devise_mail(user, opts[:invitation_instructions] || :invitation_instructions, opts) end |