fix(2FA): use serializable transaction for failed attempts recording
This commit is contained in:
1 parent
df913fd77f
commit
5c5d1c3524
4 files changed
+38
-13
No files matched your search
@@ -88,10 +88,11 @@ export async function POST(request: Request) {
|
||||
// Verify TOTP
|
||||
const secret = decryptSecret(twoFactor.secret);
|
||||
if (!(await verifyTotp(token, secret))) {
|
||||
await recordFailedAttempt(userId);
|
||||
const { lockedUntil } = await recordFailedAttempt(userId);
|
||||
return badRequest({
|
||||
code: 'two-factor-error-invalid-code',
|
||||
message: 'Invalid verification code',
|
||||
...(lockedUntil && { lockedUntil }),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user