From 79f328154841152d1add7d2035ff125a6ccc5e25 Mon Sep 17 00:00:00 2001 From: Raphael Randschau <nicolai86@me.com> 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 @@ <dd><i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.disable_register"}}</dt> <dd><i class="fa fa{{if .Service.DisableRegistration}}-check{{end}}-square-o"></i></dd> + <dt>{{.i18n.Tr "admin.config.show_registration_button"}}</dt> + <dd><i class="fa fa{{if .Service.ShowRegistrationButton}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.require_sign_in_view"}}</dt> <dd><i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.mail_notify"}}</dt> From 3c65265871ce6d8305250ef870a751ebf47257ea Mon Sep 17 00:00:00 2001 From: Raphael Randschau <nicolai86@me.com> 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 @@ <input class="ipt ipt-large" name="password" type="password" placeholder="{{.i18n.Tr "home.password_holder"}}"/> <input name="from" type="hidden" value="home"> <button class="btn btn-black btn-large">{{.i18n.Tr "sign_in"}}</button> + {{if .ShowRegistrationButton}} <button class="btn btn-green btn-large" id="register-button">{{.i18n.Tr "register"}}</button> + {{end}} </form> <div id="promo-social" class="social-buttons"> {{template "ng/base/social" .}} From 92036a78d1b00dddd3ab46a7025024cb29e91996 Mon Sep 17 00:00:00 2001 From: Raphael Randschau <nicolai86@me.com> Date: Thu, 5 Feb 2015 18:10:52 +0100 Subject: [PATCH 3/3] Add locales (en/de native, rest -> translate.google.com) --- conf/locale/locale_de-DE.ini | 1 + conf/locale/locale_en-US.ini | 1 + conf/locale/locale_fr-CA.ini | 1 + conf/locale/locale_ja-JP.ini | 1 + conf/locale/locale_lv-LV.ini | 1 + conf/locale/locale_nl-NL.ini | 1 + conf/locale/locale_ru-RU.ini | 1 + conf/locale/locale_zh-CN.ini | 3 ++- conf/locale/locale_zh-HK.ini | 1 + 9 files changed, 10 insertions(+), 1 deletion(-) diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini index dbf31a329..2d22d0491 100755 --- a/conf/locale/locale_de-DE.ini +++ b/conf/locale/locale_de-DE.ini @@ -631,6 +631,7 @@ config.db_path_helper=(nur für "sqlite3") config.service_config=Service-Einstellungen config.register_email_confirm=E-Mail-Bestätigung bei Registrierung config.disable_register=Registrierung deaktivieren +config.show_registration_button = Registrierungs-Button anzeigen config.require_sign_in_view=Ansehen erfordert Registrierung config.mail_notify=E-Mail-Benachrichtigung config.enable_cache_avatar=Avatar-Cache aktivieren diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 660fb253b..4b8325ef4 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -635,6 +635,7 @@ config.db_path_helper = (for "sqlite3" only) config.service_config = Service Configuration config.register_email_confirm = Require E-mail Confirmation config.disable_register = Disable Registration +config.show_registration_button = Show Register Button config.require_sign_in_view = Require Sign In View config.mail_notify = Mail Notification config.enable_cache_avatar = Enable Cache Avatar diff --git a/conf/locale/locale_fr-CA.ini b/conf/locale/locale_fr-CA.ini index 833d8e1dc..06a810e55 100755 --- a/conf/locale/locale_fr-CA.ini +++ b/conf/locale/locale_fr-CA.ini @@ -631,6 +631,7 @@ config.db_path_helper=("sqlite3" uniquement) config.service_config=Configuration du Service config.register_email_confirm=Require E-mail Confirmation config.disable_register=Désactiver l'Enregistrement +config.show_registration_button = Affichage bouton Se inscrire config.require_sign_in_view=Connexion Obligatoire pour Visualiser config.mail_notify=Mailer les Notifications config.enable_cache_avatar=Activer le Cache d'Avatar diff --git a/conf/locale/locale_ja-JP.ini b/conf/locale/locale_ja-JP.ini index 1d1d61493..135350d03 100755 --- a/conf/locale/locale_ja-JP.ini +++ b/conf/locale/locale_ja-JP.ini @@ -631,6 +631,7 @@ config.db_path_helper=(「sqlite3」のみ) config.service_config=サービスの構成 config.register_email_confirm=電子メールの確認を必要 config.disable_register=登録を無効にする +config.show_registration_button = 表示レジスタボタン config.require_sign_in_view=サインインを要求 config.mail_notify=メール通知 config.enable_cache_avatar=アバターのキャッシュを有効にします。 diff --git a/conf/locale/locale_lv-LV.ini b/conf/locale/locale_lv-LV.ini index 19373118f..266c3e63a 100755 --- a/conf/locale/locale_lv-LV.ini +++ b/conf/locale/locale_lv-LV.ini @@ -631,6 +631,7 @@ config.db_path_helper=(tikai Sqlite3 datu bāzei) config.service_config=Pakalpojuma konfigurācija config.register_email_confirm=Pieprasīt e-pasta apstiprināšanu config.disable_register=Atspējot jaunu lietotāju reģistrāciju +config.show_registration_button = config.require_sign_in_view=Nepieciešama autorizācija config.mail_notify=Pasta paziņojumi config.enable_cache_avatar=Glabāt profila attēlus kešatmiņā diff --git a/conf/locale/locale_nl-NL.ini b/conf/locale/locale_nl-NL.ini index f0bc7c70a..9957bf1eb 100755 --- a/conf/locale/locale_nl-NL.ini +++ b/conf/locale/locale_nl-NL.ini @@ -631,6 +631,7 @@ config.db_path_helper=(alleen voor "sqlite3") config.service_config=Serviceconfiguratie config.register_email_confirm=E-mailbevestiging registreren config.disable_register=Registratie uitgeschakeld +config.show_registration_button =Weergave knop Registreren config.require_sign_in_view=Inloggen vereist om te kunnen inzien config.mail_notify=E-mailnotificaties config.enable_cache_avatar=Avatar Cache inschakelen diff --git a/conf/locale/locale_ru-RU.ini b/conf/locale/locale_ru-RU.ini index b0da5c550..dfb5870df 100755 --- a/conf/locale/locale_ru-RU.ini +++ b/conf/locale/locale_ru-RU.ini @@ -631,6 +631,7 @@ config.db_path_helper=(for "sqlite3" only) config.service_config=Service Configuration config.register_email_confirm=Require E-mail Confirmation config.disable_register=Отключить регистрацию +config.show_registration_button = Показать Регистрация Кнопка config.require_sign_in_view=Для просмотра необходима авторизация config.mail_notify=Почтовые уведомления config.enable_cache_avatar=Кешировать аватар diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini index 49c013a9f..8a91570cb 100755 --- a/conf/locale/locale_zh-CN.ini +++ b/conf/locale/locale_zh-CN.ini @@ -359,7 +359,7 @@ settings.githook_name=钩子名称 settings.githook_content=钩子文本 settings.update_githook=更新钩子设置 settings.remove_hook_success=Web 钩子删除成功! -settings.add_webhook_desc=我们会通过 <code>POST</code> 请求将订阅事件信息发送至向指定 URL 地址。您可以设置不同的数据接收方式(JSON 或 <code>x-www-form-urlencoded</code>)。 请查阅 <a target="_blank" href="%s">Webhooks 文档</a> 获取更多信息。 +settings.add_webhook_desc=我们会通过 <code>POST</code> 请求将订阅事件信息发送至向指定 URL 地址。您可以设置不同的数据接收方式(JSON 或 <code>x-www-form-urlencoded</code>)。 请查阅 <a target="_blank" href="%s">Webhooks 文档</a> 获取更多信息。 settings.payload_url=推送地址 settings.content_type=数据格式 settings.secret=密钥文本 @@ -631,6 +631,7 @@ config.db_path_helper=(仅限 "sqlite3" 使用) config.service_config=服务配置 config.register_email_confirm=注册邮件确认 config.disable_register=关闭注册功能 +config.show_registration_button = 显示注册按钮 config.require_sign_in_view=强制登录浏览 config.mail_notify=邮件通知提醒 config.enable_cache_avatar=开启缓存头像 diff --git a/conf/locale/locale_zh-HK.ini b/conf/locale/locale_zh-HK.ini index accf07957..969d3c547 100755 --- a/conf/locale/locale_zh-HK.ini +++ b/conf/locale/locale_zh-HK.ini @@ -631,6 +631,7 @@ config.db_path_helper=(僅限 "sqlite3" 使用) config.service_config=服務配置 config.register_email_confirm=註冊電子郵件確認 config.disable_register=關閉註冊功能 +config.show_register_button = config.require_sign_in_view=強制登錄瀏覽 config.mail_notify=郵件通知提醒 config.enable_cache_avatar=開啟緩存頭像