mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fixup: capture sessions before update; match sibling exception code
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
301fe9b560
commit
2f94ff0f98
3 files changed
+5
-3
No files matched your search
@@ -3932,6 +3932,8 @@ Http::put('/v1/account/recovery')
|
||||
|
||||
$hooks->trigger('passwordValidator', [$dbForProject, $project, $password, &$user, true]);
|
||||
|
||||
$sessions = $profile->getAttribute('sessions', []);
|
||||
|
||||
$profile = $dbForProject->updateDocument('users', $profile->getId(), new Document(
|
||||
[
|
||||
'password' => $newPassword,
|
||||
@@ -3946,7 +3948,7 @@ Http::put('/v1/account/recovery')
|
||||
|
||||
$invalidate = $project->getAttribute('auths', default: [])['invalidateSessions'] ?? false;
|
||||
if ($invalidate) {
|
||||
foreach ($profile->getAttribute('sessions', []) as $session) {
|
||||
foreach ($sessions as $session) {
|
||||
/** @var Document $session */
|
||||
$dbForProject->deleteDocument('sessions', $session->getId());
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class Get extends Action
|
||||
}
|
||||
|
||||
if ($membership->getAttribute('teamInternalId') !== $team->getSequence()) {
|
||||
throw new Exception(Exception::MEMBERSHIP_NOT_FOUND);
|
||||
throw new Exception(Exception::TEAM_MEMBERSHIP_MISMATCH);
|
||||
}
|
||||
|
||||
// Default should be "false", but existing projects already rely on this being "true"
|
||||
|
||||
@@ -79,7 +79,7 @@ class Update extends Action
|
||||
}
|
||||
|
||||
if ($membership->getAttribute('teamInternalId') !== $team->getSequence()) {
|
||||
throw new Exception(Exception::MEMBERSHIP_NOT_FOUND);
|
||||
throw new Exception(Exception::TEAM_MEMBERSHIP_MISMATCH);
|
||||
}
|
||||
|
||||
$profile = $dbForProject->getDocument('users', $membership->getAttribute('userId'));
|
||||
|
||||
Reference in new issue
Block a user