fix: mfa backup codes

This commit is contained in:
Torsten Dittmann committed 2024-02-25 11:47:22 +01:00
1 parent 3963b65f68
commit 194c61a47f
1 file changed
+2 -2
+2 -2
View File
@@ -3918,11 +3918,11 @@ App::put('/v1/account/mfa/challenge')
};
if (!$success && $provider === 'totp') {
$backups = $user->getAttribute('mfaBackups', []);
$backups = $user->getAttribute('totpBackup', []);
if (in_array($otp, $backups)) {
$success = true;
$backups = array_diff($backups, [$otp]);
$user->setAttribute('mfaBackups', $backups);
$user->setAttribute('totpBackup', $backups);
$dbForProject->updateDocument('users', $user->getId(), $user);
}
}