0
0
Fork 0

Add rate-limit of TOTP authentication attempts at controller level (#28801)

This commit is contained in:
Claire 2024-01-19 13:19:49 +01:00 committed by GitHub
parent 5fc4ae7c5f
commit 3593ee2e36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 0 deletions

View file

@ -66,6 +66,11 @@ module Auth::TwoFactorAuthenticationConcern
end
def authenticate_with_two_factor_via_otp(user)
if check_second_factor_rate_limits(user)
flash.now[:alert] = I18n.t('users.rate_limited')
return prompt_for_two_factor(user)
end
if valid_otp_attempt?(user)
on_authentication_success(user, :otp)
else