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:
Jake BarnbyandClaude Opus 4.7 committed 2026-05-28 22:47:47 +12:00
1 parent 301fe9b560
commit 2f94ff0f98
3 files changed
+5 -3

No files matched your search

+3 -1
View File
@@ -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'));