summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/authenticates_with_two_factor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns/authenticates_with_two_factor.rb')
-rw-r--r--app/controllers/concerns/authenticates_with_two_factor.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/concerns/authenticates_with_two_factor.rb b/app/controllers/concerns/authenticates_with_two_factor.rb
index 4228a93d310..fbaa754124c 100644
--- a/app/controllers/concerns/authenticates_with_two_factor.rb
+++ b/app/controllers/concerns/authenticates_with_two_factor.rb
@@ -89,6 +89,7 @@ module AuthenticatesWithTwoFactor
user.save!
sign_in(user, message: :two_factor_authenticated, event: :authentication)
else
+ send_two_factor_otp_attempt_failed_email(user)
handle_two_factor_failure(user, 'OTP', _('Invalid two-factor code.'))
end
end
@@ -158,6 +159,10 @@ module AuthenticatesWithTwoFactor
prompt_for_two_factor(user)
end
+ def send_two_factor_otp_attempt_failed_email(user)
+ user.notification_service.two_factor_otp_attempt_failed(user, request.remote_ip)
+ end
+
def log_failed_two_factor(user, method)
# overridden in EE
end