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.

42 lines
1.2 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. return if @resource.disabled?
  10. I18n.with_locale(@resource.locale || I18n.default_locale) do
  11. mail to: @resource.unconfirmed_email.blank? ? @resource.email : @resource.unconfirmed_email, subject: I18n.t('devise.mailer.confirmation_instructions.subject', instance: @instance)
  12. end
  13. end
  14. def reset_password_instructions(user, token, _opts = {})
  15. @resource = user
  16. @token = token
  17. @instance = Rails.configuration.x.local_domain
  18. return if @resource.disabled?
  19. I18n.with_locale(@resource.locale || I18n.default_locale) do
  20. mail to: @resource.email, subject: I18n.t('devise.mailer.reset_password_instructions.subject')
  21. end
  22. end
  23. def password_change(user, _opts = {})
  24. @resource = user
  25. @instance = Rails.configuration.x.local_domain
  26. return if @resource.disabled?
  27. I18n.with_locale(@resource.locale || I18n.default_locale) do
  28. mail to: @resource.email, subject: I18n.t('devise.mailer.password_change.subject')
  29. end
  30. end
  31. end