diff options
-rw-r--r-- | .gopmfile | 7 | ||||
-rw-r--r-- | cmd/web.go | 5 | ||||
-rw-r--r-- | modules/setting/setting.go | 12 | ||||
-rw-r--r-- | routers/admin/admin.go | 1 | ||||
-rw-r--r-- | templates/admin/config.tmpl | 4 |
5 files changed, 7 insertions, 22 deletions
@@ -6,9 +6,8 @@ github.com/beego/memcache = commit:2aea774416 github.com/beego/redigo = commit:856744a0d5 github.com/Unknwon/cae = commit:2e70a1351b github.com/Unknwon/com = -github.com/Unknwon/goconfig = commit:0f8d8dc1c0 github.com/Unknwon/i18n = commit:aec5f77857 -github.com/Unknwon/macaron = commit:3d307c1232 +github.com/Unknwon/macaron = github.com/codegangsta/cli = commit:7381bc4e62 github.com/go-sql-driver/mysql = commit:8111ee3ec3 github.com/go-xorm/core = commit:3e0fa232ab @@ -20,9 +19,9 @@ github.com/macaron-contrib/binding = github.com/macaron-contrib/cache = commit:0bb9e6c9ef github.com/macaron-contrib/captcha = commit:3567dc48b8 github.com/macaron-contrib/csrf = commit:422b79675c -github.com/macaron-contrib/i18n = commit:184bb832f2 +github.com/macaron-contrib/i18n = github.com/macaron-contrib/oauth2 = commit:8f394c3629 -github.com/macaron-contrib/session = commit:f00d48fd4f +github.com/macaron-contrib/session = github.com/macaron-contrib/toolbox = commit:57127bcc89 github.com/mattn/go-sqlite3 = commit:a80c27ba33 github.com/nfnt/resize = commit:581d15cb53 diff --git a/cmd/web.go b/cmd/web.go index 2251ea9218..56df5fe721 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -133,10 +133,7 @@ func newMacaron() *macaron.Macaron { m.Use(captcha.Captchaer(captcha.Options{ SubURL: setting.AppSubUrl, })) - m.Use(session.Sessioner(session.Options{ - Provider: setting.SessionProvider, - Config: *setting.SessionConfig, - })) + m.Use(session.Sessioner(setting.SessionConfig)) m.Use(csrf.Csrfer(csrf.Options{ Secret: setting.SecretKey, SetCookie: true, diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 76e1ab7696..cda50b8e98 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -104,8 +104,7 @@ var ( EnableMemcache bool // Session settings. - SessionProvider string - SessionConfig *session.Config + SessionConfig session.Options // Git settings. MaxGitDiffLines int @@ -412,22 +411,15 @@ func newCacheService() { } func newSessionService() { - SessionProvider = Cfg.MustValueRange("session", "PROVIDER", "memory", + SessionConfig.Provider = Cfg.MustValueRange("session", "PROVIDER", "memory", []string{"memory", "file", "redis", "mysql"}) - - 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) SessionConfig.Maxlifetime = Cfg.MustInt64("session", "SESSION_LIFE_TIME", 86400) - if SessionProvider == "file" { - os.MkdirAll(path.Dir(SessionConfig.ProviderConfig), os.ModePerm) - } - log.Info("Session Service Enabled") } diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 99bae8819a..563a9cdc41 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -202,7 +202,6 @@ func Config(ctx *middleware.Context) { ctx.Data["CacheInternal"] = setting.CacheInternal ctx.Data["CacheConn"] = setting.CacheConn - ctx.Data["SessionProvider"] = setting.SessionProvider ctx.Data["SessionConfig"] = setting.SessionConfig ctx.Data["PictureService"] = setting.PictureService diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 3ccb106bc4..9dd25081ac 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -169,13 +169,11 @@ <div class="panel-body"> <dl class="dl-horizontal admin-dl-horizontal"> <dt>{{.i18n.Tr "admin.config.session_provider"}}</dt> - <dd>{{.SessionProvider}}</dd> + <dd>{{.SessionConfig.Provider}}</dd> <dt>{{.i18n.Tr "admin.config.provider_config"}}</dt> <dd><pre>{{.SessionConfig.ProviderConfig}}</pre></dd> <dt>{{.i18n.Tr "admin.config.cookie_name"}}</dt> <dd>{{.SessionConfig.CookieName}}</dd> - <dt>{{.i18n.Tr "admin.config.enable_set_cookie"}}</dt> - <dd><i class="fa fa{{if .SessionConfig.EnableSetCookie}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.gc_interval_time"}}</dt> <dd>{{.SessionConfig.Gclifetime}} {{.i18n.Tr "tool.raw_seconds"}}</dd> <dt>{{.i18n.Tr "admin.config.session_life_time"}}</dt> |