fix: clear legacy admin_token cookie with path=/ on logout
Users who logged in before the path isolation change (path=/ to path=/admin) may have stale cookies that cause authentication conflicts. This fix ensures both the old path=/ and new path=/admin cookies are cleared on logout. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,13 @@ def admin_logout(response: Response):
|
|||||||
path="/admin",
|
path="/admin",
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.debug("Deleted admin_token cookie")
|
# Also clear legacy cookie with path=/ (from before path isolation was added)
|
||||||
|
# This handles users who logged in before the path=/admin change
|
||||||
|
response.delete_cookie(
|
||||||
|
key="admin_token",
|
||||||
|
path="/",
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.debug("Deleted admin_token cookies (both /admin and / paths)")
|
||||||
|
|
||||||
return LogoutResponse(message="Logged out successfully")
|
return LogoutResponse(message="Logged out successfully")
|
||||||
|
|||||||
Reference in New Issue
Block a user