summaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorTamal Saha <tamal@appscode.com>2019-07-12 06:57:31 -0700
committertechknowlogick <techknowlogick@gitea.io>2019-07-12 09:57:31 -0400
commit2102f9d92db308f694707ebe6253beb20c5f7505 (patch)
tree2a09910b2fb4b3b4c151966c3a7620f48a566633 /modules/setting
parentd95237b56199934418816aaef4881ca538637c05 (diff)
downloadgitea-2102f9d92db308f694707ebe6253beb20c5f7505.tar.gz
gitea-2102f9d92db308f694707ebe6253beb20c5f7505.zip
Support setting cookie domain (#6288)
Signed-off-by: Tamal Saha <tamal@appscode.com>
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/session.go1
-rw-r--r--modules/setting/setting.go5
2 files changed, 5 insertions, 1 deletions
diff --git a/modules/setting/session.go b/modules/setting/session.go
index 313c3c76b5..7009576ccb 100644
--- a/modules/setting/session.go
+++ b/modules/setting/session.go
@@ -34,6 +34,7 @@ func newSessionService() {
SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool(false)
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
+ SessionConfig.Domain = Cfg.Section("session").Key("DOMAIN").String()
shadowConfig, err := json.Marshal(SessionConfig)
if err != nil {
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 7201f0619d..6a5c5a36d7 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -287,7 +287,8 @@ var (
// Time settings
TimeFormat string
- CSRFCookieName = "_csrf"
+ CSRFCookieName = "_csrf"
+ CSRFCookieHTTPOnly = true
// Mirror settings
Mirror struct {
@@ -781,6 +782,8 @@ func NewContext() {
ImportLocalPaths = sec.Key("IMPORT_LOCAL_PATHS").MustBool(false)
DisableGitHooks = sec.Key("DISABLE_GIT_HOOKS").MustBool(false)
PasswordHashAlgo = sec.Key("PASSWORD_HASH_ALGO").MustString("pbkdf2")
+ CSRFCookieHTTPOnly = sec.Key("CSRF_COOKIE_HTTP_ONLY").MustBool(true)
+
InternalToken = loadInternalToken(sec)
IterateBufferSize = Cfg.Section("database").Key("ITERATE_BUFFER_SIZE").MustInt(50)
LogSQL = Cfg.Section("database").Key("LOG_SQL").MustBool(true)