Skip to content

Commit af2a911

Browse files
authored
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
1 parent adec5f4 commit af2a911

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ui/src/store/modules/user.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,17 @@ const user = {
472472
}).catch(() => {
473473
resolve()
474474
}).finally(() => {
475+
const paths = ['/', '/client']
476+
const hostname = window.location.hostname
477+
const domains = [undefined, hostname, `.${hostname}`]
475478
Object.keys(Cookies.get()).forEach(cookieName => {
476-
Cookies.remove(cookieName)
477-
Cookies.remove(cookieName, { path: '/client' })
479+
paths.forEach(path => {
480+
domains.forEach(domain => {
481+
const options = { path }
482+
if (domain) options.domain = domain
483+
Cookies.remove(cookieName, options)
484+
})
485+
})
478486
})
479487
})
480488
})

0 commit comments

Comments
 (0)