mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
add validation for used OTP codes
This commit is contained in:
@@ -293,6 +293,10 @@ async function getValidatedCode(
|
|||||||
if (otpData.expires_at < new Date()) {
|
if (otpData.expires_at < new Date()) {
|
||||||
throw new OTPError("Code expired");
|
throw new OTPError("Code expired");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (otpData.used_at) {
|
||||||
|
throw new OTPError("Code already used");
|
||||||
|
}
|
||||||
|
|
||||||
return otpData;
|
return otpData;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user