fix API changes

release/v1.15
Unknwon 2014-12-28 20:40:35 +08:00
parent 6a6636d451
commit 81a44e4cd0
5 changed files with 7 additions and 22 deletions

View File

@ -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

View File

@ -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,

View File

@ -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")
}

View File

@ -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

View File

@ -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>