]> source.dussan.org Git - gitea.git/commitdiff
code fix for #908, and work for #884
authorUnknwon <joe2010xtmf@163.com>
Sat, 7 Feb 2015 02:16:23 +0000 (21:16 -0500)
committerUnknwon <joe2010xtmf@163.com>
Sat, 7 Feb 2015 02:16:23 +0000 (21:16 -0500)
modules/middleware/context.go
modules/setting/setting.go
routers/home.go
templates/ng/base/header.tmpl

index fc7814401fe47f1d5305f8d9b8df4973efed5772..28be3a302584598918eb380d973c0279bd5a93b3 100644 (file)
@@ -192,6 +192,8 @@ func Contexter() macaron.Handler {
                ctx.Data["CsrfToken"] = x.GetToken()
                ctx.Data["CsrfTokenHtml"] = template.HTML(`<input type="hidden" name="_csrf" value="` + x.GetToken() + `">`)
 
+               ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
+
                c.Map(ctx)
        }
 }
index 4d407362c5feabcea00d451384b12cba00c66990..e79e6d6b967760d2924f56c21e63545816ace9d5 100644 (file)
@@ -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()
index 24fc77e12a615a87f6844a7fe4ddff76d3a445b1..dd604ec7e340d6e6bf85ccbf427e77b5d40b5945 100644 (file)
@@ -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)
index aec4e2ef6693e77d65d98d2146945e6e6b11cd5b..da9218368dbff3b53711bb156cca6f8e75a306d7 100644 (file)
             <li class="right" id="header-nav-sign-in">
                 <a href="{{AppSubUrl}}/user/login" title="Sign In"><i class="octicon octicon-sign-in"></i> {{.i18n.Tr "sign_in"}}</a>
             </li>
+            {{if .ShowRegistrationButton}}
             <li class="right">
                 <a href="{{AppSubUrl}}/user/sign_up" title="Account Settings"><i class="octicon octicon-person-add"></i> {{.i18n.Tr "register"}}</a>
             </li>
             {{end}}
+            {{end}}
         {{end}}
     </ul>
 </header>
\ No newline at end of file