mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-07-01 03:24:29 +08:00
Merge pull request #6331 from tb365/bugfix/tb-bugfix-0514
clear yunionauth cookie
This commit is contained in:
@@ -439,8 +439,12 @@ func getCookie(r *http.Request, name string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func clearCookie(w http.ResponseWriter, name string) {
|
||||
func clearCookie(w http.ResponseWriter, name string, domain string) {
|
||||
cookie := &http.Cookie{Name: name, Expires: time.Now(), Path: "/", MaxAge: -1, HttpOnly: false}
|
||||
if len(domain) > 0 {
|
||||
cookie.Domain = domain
|
||||
}
|
||||
|
||||
http.SetCookie(w, cookie)
|
||||
}
|
||||
|
||||
@@ -541,7 +545,7 @@ func (h *AuthHandlers) postLogoutHandler(ctx context.Context, w http.ResponseWri
|
||||
if len(tid) > 0 {
|
||||
clientman.TokenMan.Remove(tid)
|
||||
}
|
||||
clearCookie(w, constants.YUNION_AUTH_COOKIE)
|
||||
clearCookie(w, constants.YUNION_AUTH_COOKIE, options.Options.CookieDomain)
|
||||
appsrv.Send(w, "")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user