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
parent e6072a8d13
commit 2e8943aecd
4 changed files with 49 additions and 1 deletions

View File

@@ -65,6 +65,11 @@ module 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