1
0
Fork 0
mirror of synced 2024-05-17 11:12:41 +12:00

Merge pull request #7981 from appwrite/fix-recovery-challenge-check

fix(auth): fix challenge type check
This commit is contained in:
Torsten Dittmann 2024-04-17 11:11:06 +02:00 committed by GitHub
commit 0919b2d06a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4069,7 +4069,7 @@ App::put('/v1/account/mfa/challenge')
$recoveryCodeChallenge = function (Document $challenge, Document $user, string $otp) use ($dbForProject) {
if (
$challenge->isSet('type') &&
$challenge->getAttribute('type') === Type::RECOVERY_CODE
$challenge->getAttribute('type') === \strtolower(Type::RECOVERY_CODE)
) {
$mfaRecoveryCodes = $user->getAttribute('mfaRecoveryCodes', []);
if (in_array($otp, $mfaRecoveryCodes)) {
@ -4091,7 +4091,7 @@ App::put('/v1/account/mfa/challenge')
Type::TOTP => Challenge\TOTP::challenge($challenge, $user, $otp),
Type::PHONE => Challenge\Phone::challenge($challenge, $user, $otp),
Type::EMAIL => Challenge\Email::challenge($challenge, $user, $otp),
Type::RECOVERY_CODE => $recoveryCodeChallenge($challenge, $user, $otp),
\strtolower(Type::RECOVERY_CODE) => $recoveryCodeChallenge($challenge, $user, $otp),
default => false
});