Skip to content

Commit b90cb30

Browse files
AndrewHaZGdhslove
authored andcommitted
UI: Make logout function more robust to prevent session issues (apache#11361)
Improve cookie cleanup during logout by removing cookies across multiple paths and domains to ensure complete session termination. Fixes apache#11078
1 parent 4ecfee2 commit b90cb30

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
@@ -507,9 +507,17 @@ const user = {
507507
}).catch(() => {
508508
resolve()
509509
}).finally(() => {
510+
const paths = ['/', '/client']
511+
const hostname = window.location.hostname
512+
const domains = [undefined, hostname, `.${hostname}`]
510513
Object.keys(Cookies.get()).forEach(cookieName => {
511-
Cookies.remove(cookieName)
512-
Cookies.remove(cookieName, { path: '/client' })
514+
paths.forEach(path => {
515+
domains.forEach(domain => {
516+
const options = { path }
517+
if (domain) options.domain = domain
518+
Cookies.remove(cookieName, options)
519+
})
520+
})
513521
})
514522
})
515523
})

0 commit comments

Comments
 (0)