mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 05:56:38 +00:00
allow backup code input for totp
This commit is contained in:
@@ -11,7 +11,9 @@ export async function verifyTotpCode(
|
||||
secret: string,
|
||||
userId: string
|
||||
): Promise<boolean> {
|
||||
if (code.length !== 6) {
|
||||
// if code is digits only, it's totp
|
||||
const isTotp = /^\d+$/.test(code);
|
||||
if (!isTotp) {
|
||||
const validBackupCode = await verifyBackUpCode(code, userId);
|
||||
return validBackupCode;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user