From 79f328154841152d1add7d2035ff125a6ccc5e25 Mon Sep 17 00:00:00 2001 From: Raphael Randschau Date: Thu, 5 Feb 2015 17:09:26 +0100 Subject: [PATCH 1/3] Add ShowRegistrationButton configuration option --- modules/setting/setting.go | 2 ++ templates/admin/config.tmpl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index e7c44cdd4..4d407362c 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -311,6 +311,7 @@ func NewConfigContext() { var Service struct { RegisterEmailConfirm bool DisableRegistration bool + ShowRegistrationButton bool RequireSignInView bool EnableCacheAvatar bool EnableNotifyMail bool @@ -324,6 +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.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/templates/admin/config.tmpl b/templates/admin/config.tmpl index 1f8a85ecb..f8b4be0b8 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -78,6 +78,8 @@
{{.i18n.Tr "admin.config.disable_register"}}
+
{{.i18n.Tr "admin.config.show_registration_button"}}
+
{{.i18n.Tr "admin.config.require_sign_in_view"}}
{{.i18n.Tr "admin.config.mail_notify"}}
From 3c65265871ce6d8305250ef870a751ebf47257ea Mon Sep 17 00:00:00 2001 From: Raphael Randschau Date: Thu, 5 Feb 2015 17:09:38 +0100 Subject: [PATCH 2/3] Hide the registration button depending on the setting --- routers/home.go | 1 + templates/home.tmpl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/routers/home.go b/routers/home.go index dd604ec7e..24fc77e12 100644 --- a/routers/home.go +++ b/routers/home.go @@ -41,6 +41,7 @@ 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/home.tmpl b/templates/home.tmpl index 8603f26f4..29865dbf9 100644 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -14,7 +14,9 @@ + {{if .ShowRegistrationButton}} + {{end}}