This commit is contained in:
Girish Ramakrishnan
2026-02-17 19:30:33 +01:00
parent 3ef990b0bf
commit 319360f8d0
5 changed files with 68 additions and 101 deletions
+1 -1
View File
@@ -921,7 +921,7 @@ async function enableTwoFactorAuthentication(user, totpToken, auditSource) {
if (user.source === 'ldap' && externalLdap.supports2FA(externalLdapConfig)) throw new BoxError(BoxError.BAD_STATE, 'Cannot enable 2FA of external auth user');
// Cannot enable TOTP if user has a passkey (user must choose one or the other)
const userPasskeys = await passkeys.list(user.id);
const userPasskeys = await passkeys.listByUserId(user.id);
if (userPasskeys.length > 0) throw new BoxError(BoxError.ALREADY_EXISTS, 'Cannot enable TOTP when passkey is registered');
const verified = speakeasy.totp.verify({ secret: user.twoFactorAuthenticationSecret, encoding: 'base32', token: totpToken, window: 2 });