0
0
Fork 0

Add e-mail-based sign in challenge for users with disabled 2FA (#14013)

This commit is contained in:
Eugen Rochko 2020-06-09 10:23:06 +02:00 committed by GitHub
parent 8b6d97fb7c
commit 72a7cfaa39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 368 additions and 51 deletions

View file

@ -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