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:
2026-01-23 18:59:17 +01:00
parent dca52d004e
commit 8662fcd6da

View File

@@ -113,6 +113,13 @@ def admin_logout(response: Response):
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")