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
This commit is contained in:
AndrewHaZG 2025-09-08 15:24:33 +08:00 committed by GitHub
parent adec5f439d
commit af2a911f1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -472,9 +472,17 @@ const user = {
}).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)
})
})
})
})
})