summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorlunnyxiao <xiaolunwen@gmail.com>2014-09-22 10:45:20 +0800
committerlunnyxiao <xiaolunwen@gmail.com>2014-09-22 10:45:20 +0800
commit79ec08141af6f156597064f5fcafc4d0af2e1a05 (patch)
treea4bc8452565eb2ac1fe2b432b1616c03572db7da /modules
parent150eef93b2340f665c070158ade1863339829e05 (diff)
parent1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19 (diff)
downloadgitea-79ec08141af6f156597064f5fcafc4d0af2e1a05.tar.gz
gitea-79ec08141af6f156597064f5fcafc4d0af2e1a05.zip
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'modules')
-rw-r--r--modules/middleware/auth.go2
-rw-r--r--modules/middleware/repo.go2
-rw-r--r--modules/setting/setting.go4
3 files changed, 6 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..67e48108d9 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -108,6 +108,7 @@ var (
ProdMode bool
RunUser string
IsWindows bool
+ HasRobotsTxt bool
)
func init() {
@@ -260,6 +261,8 @@ func NewConfigContext() {
Langs = Cfg.MustValueArray("i18n", "LANGS", ",")
Names = Cfg.MustValueArray("i18n", "NAMES", ",")
+
+ HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
}
var Service struct {
@@ -380,6 +383,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)