Jelajahi Sumber

csrf: able to set custom cookie name

Add new config option '[session] CSRF_COOKIE_NAME'.
Unknwon 8 tahun lalu
induk
melakukan
054e97d614
5 mengubah file dengan 6 tambahan dan 3 penghapusan
  1. 2 0
      conf/app.ini
  2. 1 1
      gogs.go
  3. 0 0
      modules/bindata/bindata.go
  4. 2 1
      modules/setting/setting.go
  5. 1 1
      templates/.VERSION

+ 2 - 0
conf/app.ini

@@ -250,6 +250,8 @@ ENABLE_SET_COOKIE = true
 GC_INTERVAL_TIME = 86400
 ; Session life time, default is 86400
 SESSION_LIFE_TIME = 86400
+; Cookie name for CSRF
+CSRF_COOKIE_NAME = _csrf
 
 [picture]
 ; Path to store user uploaded avatars

+ 1 - 1
gogs.go

@@ -16,7 +16,7 @@ import (
 	"github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.9.165.0222 / 0.10 RC"
+const APP_VER = "0.9.166.0222 / 0.10 RC"
 
 func init() {
 	setting.AppVer = APP_VER

File diff ditekan karena terlalu besar
+ 0 - 0
modules/bindata/bindata.go


+ 2 - 1
modules/setting/setting.go

@@ -187,7 +187,7 @@ var (
 
 	// Session settings
 	SessionConfig  session.Options
-	CSRFCookieName = "_csrf"
+	CSRFCookieName string
 
 	// Cron tasks
 	Cron struct {
@@ -744,6 +744,7 @@ func newSessionService() {
 	SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
 	SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
 	SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
+	CSRFCookieName = Cfg.Section("session").Key("CSRF_COOKIE_NAME").MustString("_csrf")
 
 	log.Info("Session Service Enabled")
 }

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.9.165.0222 / 0.10 RC
+0.9.166.0222 / 0.10 RC

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini