Add e-mail-based sign in challenge for users with disabled 2FA (#14013)
This commit is contained in:
parent
8b6d97fb7c
commit
72a7cfaa39
14 changed files with 368 additions and 51 deletions
|
@ -126,4 +126,21 @@ class UserMailer < Devise::Mailer
|
|||
reply_to: Setting.site_contact_email
|
||||
end
|
||||
end
|
||||
|
||||
def sign_in_token(user, remote_ip, user_agent, timestamp)
|
||||
@resource = user
|
||||
@instance = Rails.configuration.x.local_domain
|
||||
@remote_ip = remote_ip
|
||||
@user_agent = user_agent
|
||||
@detection = Browser.new(user_agent)
|
||||
@timestamp = timestamp.to_time.utc
|
||||
|
||||
return if @resource.disabled?
|
||||
|
||||
I18n.with_locale(@resource.locale || I18n.default_locale) do
|
||||
mail to: @resource.email,
|
||||
subject: I18n.t('user_mailer.sign_in_token.subject'),
|
||||
reply_to: Setting.site_contact_email
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue