Add notification email on invalid second authenticator (#28822)
This commit is contained in:
parent
18004bf227
commit
e2d9635074
8 changed files with 102 additions and 3 deletions
|
@ -181,6 +181,11 @@ class Auth::SessionsController < Devise::SessionsController
|
|||
ip: request.remote_ip,
|
||||
user_agent: request.user_agent
|
||||
)
|
||||
|
||||
# Only send a notification email every hour at most
|
||||
return if redis.set("2fa_failure_notification:#{user.id}", '1', ex: 1.hour, get: true).present?
|
||||
|
||||
UserMailer.failed_2fa(user, request.remote_ip, request.user_agent, Time.now.utc).deliver_later!
|
||||
end
|
||||
|
||||
def second_factor_attempts_key(user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue