Add password challenge to 2FA settings, e-mail notifications (#11878)
Fix #3961
This commit is contained in:
@ -57,6 +57,39 @@ class UserMailer < Devise::Mailer
|
||||
end
|
||||
end
|
||||
|
||||
def two_factor_enabled(user, **)
|
||||
@resource = user
|
||||
@instance = Rails.configuration.x.local_domain
|
||||
|
||||
return if @resource.disabled?
|
||||
|
||||
I18n.with_locale(@resource.locale || I18n.default_locale) do
|
||||
mail to: @resource.email, subject: I18n.t('devise.mailer.two_factor_enabled.subject')
|
||||
end
|
||||
end
|
||||
|
||||
def two_factor_disabled(user, **)
|
||||
@resource = user
|
||||
@instance = Rails.configuration.x.local_domain
|
||||
|
||||
return if @resource.disabled?
|
||||
|
||||
I18n.with_locale(@resource.locale || I18n.default_locale) do
|
||||
mail to: @resource.email, subject: I18n.t('devise.mailer.two_factor_disabled.subject')
|
||||
end
|
||||
end
|
||||
|
||||
def two_factor_recovery_codes_changed(user, **)
|
||||
@resource = user
|
||||
@instance = Rails.configuration.x.local_domain
|
||||
|
||||
return if @resource.disabled?
|
||||
|
||||
I18n.with_locale(@resource.locale || I18n.default_locale) do
|
||||
mail to: @resource.email, subject: I18n.t('devise.mailer.two_factor_recovery_codes_changed.subject')
|
||||
end
|
||||
end
|
||||
|
||||
def welcome(user)
|
||||
@resource = user
|
||||
@instance = Rails.configuration.x.local_domain
|
||||
|
Reference in New Issue
Block a user