mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Merge pull request #10004 from appwrite/fix-invalid-factors
fix: prevent 'Attribute "factors" must be an array' error
This commit is contained in:
commit
52f83c4015
1 changed files with 3 additions and 3 deletions
|
|
@ -3880,7 +3880,7 @@ App::patch('/v1/account/mfa')
|
|||
if ($user->getAttribute('phone', false) && $user->getAttribute('phoneVerification', false)) {
|
||||
$factors[] = Type::PHONE;
|
||||
}
|
||||
$factors = \array_unique($factors);
|
||||
$factors = \array_values(\array_unique($factors));
|
||||
|
||||
$session->setAttribute('factors', $factors);
|
||||
$dbForProject->updateDocument('sessions', $session->getId(), $session);
|
||||
|
|
@ -4065,7 +4065,7 @@ App::put('/v1/account/mfa/authenticators/:type')
|
|||
|
||||
$factors = $session->getAttribute('factors', []);
|
||||
$factors[] = $type;
|
||||
$factors = \array_unique($factors);
|
||||
$factors = \array_values(\array_unique($factors));
|
||||
|
||||
$session->setAttribute('factors', $factors);
|
||||
$dbForProject->updateDocument('sessions', $session->getId(), $session);
|
||||
|
|
@ -4549,7 +4549,7 @@ App::put('/v1/account/mfa/challenge')
|
|||
|
||||
$factors = $session->getAttribute('factors', []);
|
||||
$factors[] = $type;
|
||||
$factors = \array_unique($factors);
|
||||
$factors = \array_values(\array_unique($factors));
|
||||
|
||||
$session
|
||||
->setAttribute('factors', $factors)
|
||||
|
|
|
|||
Loading…
Reference in a new issue