summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMartin van Beurden <chadoe@gmail.com>2014-09-21 14:07:00 +0200
committerMartin van Beurden <chadoe@gmail.com>2014-09-21 14:25:22 +0200
commit976f1486e01548bfb420a7c809ede6fc273e4a26 (patch)
treecef9d08801579d72dfb5c42e8bf8019f23f9dff6 /modules
parentcb0ea46d1e06ec64358807d4e0fc49d9ecece311 (diff)
downloadgitea-976f1486e01548bfb420a7c809ede6fc273e4a26.tar.gz
gitea-976f1486e01548bfb420a7c809ede6fc273e4a26.zip
Set cookiepath to AppSubUrl
Diffstat (limited to 'modules')
-rw-r--r--modules/middleware/auth.go2
-rw-r--r--modules/middleware/repo.go2
-rw-r--r--modules/setting/setting.go1
3 files changed, 3 insertions, 2 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index 8fae5d1ece..2bc05697a9 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -48,7 +48,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
return
}
- ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
+ ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 79b01133bd..f17018ddf3 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -298,7 +298,7 @@ func RequireTrueOwner() macaron.Handler {
return func(ctx *Context) {
if !ctx.Repo.IsTrueOwner && !ctx.Repo.IsAdmin {
if !ctx.IsSigned {
- ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
+ ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
}
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 321282df25..a1ab43d022 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -380,6 +380,7 @@ func newSessionService() {
SessionConfig = new(session.Config)
SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ")
SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits")
+ SessionConfig.CookiePath = AppSubUrl
SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE")
SessionConfig.EnableSetCookie = Cfg.MustBool("session", "ENABLE_SET_COOKIE", true)
SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400)