UI: Make logout function more robust to prevent session issues (#11361)
Improve cookie cleanup during logout by removing cookies across
multiple paths and domains to ensure complete session termination.
Fixes #11078
diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js
index 6113f3e..5c9dff6 100644
--- a/ui/src/store/modules/user.js
+++ b/ui/src/store/modules/user.js
@@ -472,9 +472,17 @@
}).catch(() => {
resolve()
}).finally(() => {
+ const paths = ['/', '/client']
+ const hostname = window.location.hostname
+ const domains = [undefined, hostname, `.${hostname}`]
Object.keys(Cookies.get()).forEach(cookieName => {
- Cookies.remove(cookieName)
- Cookies.remove(cookieName, { path: '/client' })
+ paths.forEach(path => {
+ domains.forEach(domain => {
+ const options = { path }
+ if (domain) options.domain = domain
+ Cookies.remove(cookieName, options)
+ })
+ })
})
})
})