From: Unknwon Date: Sat, 7 Feb 2015 02:16:23 +0000 (-0500) Subject: code fix for #908, and work for #884 X-Git-Tag: v0.9.99~1489 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=216683004e8bf3e7523236416be21b2123d32e8e;p=gitea.git code fix for #908, and work for #884 --- diff --git a/modules/middleware/context.go b/modules/middleware/context.go index fc7814401f..28be3a3025 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -192,6 +192,8 @@ func Contexter() macaron.Handler { ctx.Data["CsrfToken"] = x.GetToken() ctx.Data["CsrfTokenHtml"] = template.HTML(``) + ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton + c.Map(ctx) } } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 4d407362c5..e79e6d6b96 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -325,7 +325,7 @@ func newService() { Service.ActiveCodeLives = Cfg.Section("service").Key("ACTIVE_CODE_LIVE_MINUTES").MustInt(180) Service.ResetPwdCodeLives = Cfg.Section("service").Key("RESET_PASSWD_CODE_LIVE_MINUTES").MustInt(180) Service.DisableRegistration = Cfg.Section("service").Key("DISABLE_REGISTRATION").MustBool() - Service.ShowRegistrationButton = Cfg.Section("service").Key("SHOW_REGISTRATION_BUTTON").MustBool() + Service.ShowRegistrationButton = Cfg.Section("service").Key("SHOW_REGISTRATION_BUTTON").MustBool(!Service.DisableRegistration) Service.RequireSignInView = Cfg.Section("service").Key("REQUIRE_SIGNIN_VIEW").MustBool() Service.EnableCacheAvatar = Cfg.Section("service").Key("ENABLE_CACHE_AVATAR").MustBool() Service.EnableReverseProxyAuth = Cfg.Section("service").Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool() diff --git a/routers/home.go b/routers/home.go index 24fc77e12a..dd604ec7e3 100644 --- a/routers/home.go +++ b/routers/home.go @@ -41,7 +41,6 @@ func Home(ctx *middleware.Context) { ctx.Data["OauthEnabled"] = true ctx.Data["OauthService"] = setting.OauthService } - ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton ctx.Data["PageIsHome"] = true ctx.HTML(200, HOME) diff --git a/templates/ng/base/header.tmpl b/templates/ng/base/header.tmpl index aec4e2ef66..da9218368d 100644 --- a/templates/ng/base/header.tmpl +++ b/templates/ng/base/header.tmpl @@ -49,10 +49,12 @@
  • {{.i18n.Tr "sign_in"}}
  • + {{if .ShowRegistrationButton}}
  • {{.i18n.Tr "register"}}
  • {{end}} + {{end}} {{end}} \ No newline at end of file