mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-29 15:00:09 +00:00
aio-interface: preserve old PHPSESSID session during cookie migration to survive 502s on mastercontainer update
Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/aadfe06c-fde4-4a01-953a-42abd110b416 fix: rename $oldSessionTime to $oldSessionTimestamp for clarity Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/aadfe06c-fde4-4a01-953a-42abd110b416 Co-Authored-By: szaimen <42591237+szaimen@users.noreply.github.com>
This commit is contained in:
committed by
Simon L.
parent
5c016d5d35
commit
301f42d2a0
@@ -42,6 +42,18 @@ readonly class AuthManager {
|
||||
$_SESSION[self::SESSION_KEY] = $isLoggedIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates the authenticated state from an old session (different cookie name) to the new session.
|
||||
* Unlike SetAuthState, this method preserves the original login timestamp and does not update
|
||||
* the session_date_file, so the session deduplicator is not triggered. This keeps the old session
|
||||
* file alive in case the response carrying the new cookie is lost (e.g., due to a 502 error during
|
||||
* a mastercontainer update), allowing the client to retry with the old cookie.
|
||||
*/
|
||||
public function MigrateAuthState(int $oldTimestamp) : void {
|
||||
$_SESSION[self::SESSION_KEY] = true;
|
||||
$_SESSION['date_time'] = $oldTimestamp;
|
||||
}
|
||||
|
||||
public function IsAuthenticated() : bool {
|
||||
return isset($_SESSION[self::SESSION_KEY]) && $_SESSION[self::SESSION_KEY] === true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user