Skip to content

Commit a0d35fb

Browse files
Forcibly clean and destroy the session on logout (#11447)
Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 5cf224a commit a0d35fb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

routers/user/auth.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,11 +994,8 @@ func LinkAccountPostRegister(ctx *context.Context, cpt *captcha.Captcha, form au
994994

995995
// HandleSignOut resets the session and sets the cookies
996996
func HandleSignOut(ctx *context.Context) {
997-
_ = ctx.Session.Delete("uid")
998-
_ = ctx.Session.Delete("uname")
999-
_ = ctx.Session.Delete("socialId")
1000-
_ = ctx.Session.Delete("socialName")
1001-
_ = ctx.Session.Delete("socialEmail")
997+
_ = ctx.Session.Flush()
998+
_ = ctx.Session.Destroy(ctx.Context)
1002999
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true)
10031000
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true)
10041001
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true)

0 commit comments

Comments
 (0)