Update the Update Account Status API to clear the cookie

After a user updates their status, their session no longer works
however, the cookie may still exist in their browser, preventing other
API calls from completing successfully.
This commit is contained in:
Steven Nguyen
2023-05-23 10:40:31 -07:00
parent f774721701
commit 9d13d72c71
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -1789,6 +1789,12 @@ App::patch('/v1/account/status')
$response->addHeader('X-Fallback-Cookies', \json_encode([]));
}
$protocol = $request->getProtocol();
$response
->addCookie(Auth::$cookieName . '_legacy', '', \time() - 3600, '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, null)
->addCookie(Auth::$cookieName, '', \time() - 3600, '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, Config::getParam('cookieSamesite'))
;
$response->dynamic($user, Response::MODEL_ACCOUNT);
});
@@ -221,6 +221,8 @@ class AccountCustomClientTest extends Scope
]);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertStringContainsString('a_session_' . $this->getProject()['$id'] . '=deleted', $response['headers']['set-cookie']);
$this->assertEquals('[]', $response['headers']['x-fallback-cookies']);
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
'origin' => 'http://localhost',