You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. # frozen_string_literal: true
  2. class UserMailer < Devise::Mailer
  3. layout 'mailer'
  4. helper :instance
  5. def confirmation_instructions(user, token, _opts = {})
  6. @resource = user
  7. @token = token
  8. @instance = Rails.configuration.x.local_domain
  9. I18n.with_locale(@resource.locale || I18n.default_locale) do
  10. mail to: @resource.unconfirmed_email.blank? ? @resource.email : @resource.unconfirmed_email, subject: I18n.t('devise.mailer.confirmation_instructions.subject', instance: @instance)
  11. end
  12. end
  13. def reset_password_instructions(user, token, _opts = {})
  14. @resource = user
  15. @token = token
  16. @instance = Rails.configuration.x.local_domain
  17. I18n.with_locale(@resource.locale || I18n.default_locale) do
  18. mail to: @resource.email, subject: I18n.t('devise.mailer.reset_password_instructions.subject')
  19. end
  20. end
  21. def password_change(user, _opts = {})
  22. @resource = user
  23. @instance = Rails.configuration.x.local_domain
  24. I18n.with_locale(@resource.locale || I18n.default_locale) do
  25. mail to: @resource.email, subject: I18n.t('devise.mailer.password_change.subject')
  26. end
  27. end
  28. end