aboutsummaryrefslogtreecommitdiff
path: root/internal/route/user/auth.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-29 00:26:03 +0800
committerGitHub <noreply@github.com>2020-02-29 00:26:03 +0800
commitd59b0f6ff7ee24d94eaa5ad68173405faea6a81c (patch)
treeaac389356946b2f6b0f5281843d1dde3ed23f121 /internal/route/user/auth.go
parent1898201b8b4e555b6dfabd58c5d1136051f35b93 (diff)
conf: overhaul sessions settings (#5952)
Diffstat (limited to 'internal/route/user/auth.go')
-rw-r--r--internal/route/user/auth.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/route/user/auth.go b/internal/route/user/auth.go
index 7c29634b..7d72eb16 100644
--- a/internal/route/user/auth.go
+++ b/internal/route/user/auth.go
@@ -66,7 +66,7 @@ func AutoLogin(c *context.Context) (bool, error) {
isSucceed = true
c.Session.Set("uid", u.ID)
c.Session.Set("uname", u.Name)
- c.SetCookie(conf.CSRFCookieName, "", -1, conf.Server.Subpath)
+ c.SetCookie(conf.Session.CSRFCookieName, "", -1, conf.Server.Subpath)
if conf.Security.EnableLoginStatusCookie {
c.SetCookie(conf.Security.LoginStatusCookieName, "true", 0, conf.Server.Subpath)
}
@@ -130,7 +130,7 @@ func afterLogin(c *context.Context, u *db.User, remember bool) {
c.Session.Delete("twoFactorUserID")
// Clear whatever CSRF has right now, force to generate a new one
- c.SetCookie(conf.CSRFCookieName, "", -1, conf.Server.Subpath)
+ c.SetCookie(conf.Session.CSRFCookieName, "", -1, conf.Server.Subpath)
if conf.Security.EnableLoginStatusCookie {
c.SetCookie(conf.Security.LoginStatusCookieName, "true", 0, conf.Server.Subpath)
}
@@ -285,7 +285,7 @@ func SignOut(c *context.Context) {
c.Session.Destory(c.Context)
c.SetCookie(conf.Security.CookieUsername, "", -1, conf.Server.Subpath)
c.SetCookie(conf.Security.CookieRememberName, "", -1, conf.Server.Subpath)
- c.SetCookie(conf.CSRFCookieName, "", -1, conf.Server.Subpath)
+ c.SetCookie(conf.Session.CSRFCookieName, "", -1, conf.Server.Subpath)
c.SubURLRedirect("/")
}