mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Finish recovery code support
This commit is contained in:
@@ -4242,6 +4242,19 @@ App::delete('/v1/account/mfa/authenticator/webauthn')
|
||||
$mfaRecoveryCodes = array_values($mfaRecoveryCodes);
|
||||
$user->setAttribute('mfaRecoveryCodes', $mfaRecoveryCodes);
|
||||
$dbForProject->updateDocument('users', $user->getId(), $user);
|
||||
|
||||
// If a recovery code is used, we wipe all WebAuthn authenticators.
|
||||
$authenticators = Webauthn::getAuthenticatorsFromUser($user);
|
||||
|
||||
foreach ($authenticators as $auth) {
|
||||
$dbForProject->deleteDocument('authenticators', $auth->getId());
|
||||
}
|
||||
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$queueForEvents->setParam('userId', $user->getId());
|
||||
|
||||
return $response->noContent();
|
||||
} else {
|
||||
throw new Exception(Exception::USER_INVALID_TOKEN);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user