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.

34 lines
1.0 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. I18n.with_locale(@resource.locale || I18n.default_locale) do
  17. mail to: @resource.email, subject: I18n.t('devise.mailer.reset_password_instructions.subject')
  18. end
  19. end
  20. def password_change(user, _opts = {})
  21. @resource = user
  22. I18n.with_locale(@resource.locale || I18n.default_locale) do
  23. mail to: @resource.email, subject: I18n.t('devise.mailer.password_change.subject')
  24. end
  25. end
  26. end