Skip to content

Commit 5c44461

Browse files
committed
Make logout function more robust to prevent session issues
Improve cookie cleanup during logout by removing cookies across multiple paths and domains to ensure complete session termination. Fixes #11078
1 parent 1f1e38f commit 5c44461

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

ui/src/store/modules/user.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,17 @@ const user = {
496496
}).catch(() => {
497497
resolve()
498498
}).finally(() => {
499+
const paths = ['/', '/client']
500+
const hostname = window.location.hostname
501+
const domains = [undefined, hostname, `.${hostname}`]
499502
Object.keys(Cookies.get()).forEach(cookieName => {
500-
Cookies.remove(cookieName)
501-
Cookies.remove(cookieName, { path: '/client' })
503+
paths.forEach(path => {
504+
domains.forEach(domain => {
505+
const options = { path }
506+
if (domain) options.domain = domain
507+
Cookies.remove(cookieName, options)
508+
})
509+
})
502510
})
503511
})
504512
})

0 commit comments

Comments
 (0)