Skip to content

Commit de9a96c

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

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
@@ -988,11 +988,8 @@ func LinkAccountPostRegister(ctx *context.Context, cpt *captcha.Captcha, form au
988988
}
989989

990990
func handleSignOut(ctx *context.Context) {
991-
_ = ctx.Session.Delete("uid")
992-
_ = ctx.Session.Delete("uname")
993-
_ = ctx.Session.Delete("socialId")
994-
_ = ctx.Session.Delete("socialName")
995-
_ = ctx.Session.Delete("socialEmail")
991+
_ = ctx.Session.Flush()
992+
_ = ctx.Session.Destroy(ctx.Context)
996993
ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true)
997994
ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true)
998995
ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true)

0 commit comments

Comments
 (0)