sec: add failed attempts for 2FA
This commit is contained in:
parent
c66f3355ec
commit
dfac9ddca8
@ -156,8 +156,13 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I
|
||||
var totp = new TotpService(firstTokenAuth.Secret);
|
||||
|
||||
if (!totp.VerifyToken(code))
|
||||
{
|
||||
await RecordFailedLoginAttempt(requestContext.Fingerprint, firstTokenAuth.UserId, cancellation);
|
||||
throw new SecurityException("Invalid verification code. Please try again.");
|
||||
}
|
||||
|
||||
await ResetFailedLoginAttempts(requestContext.Fingerprint, cancellation);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException("Unsupported authorization method.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user