Browse Source

Merge pull request #908 from nicolai86/feature/hide-signup-button-884

Make Signup button display configurable - #884
无闻 10 years ago
parent
commit
87b90372a7

+ 1 - 0
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

+ 1 - 0
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

+ 1 - 0
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

+ 1 - 0
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=アバターのキャッシュを有効にします。

+ 1 - 0
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ņā

+ 1 - 0
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

+ 1 - 0
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=Кешировать аватар

+ 2 - 1
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=开启缓存头像

+ 1 - 0
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=開啟緩存頭像

+ 2 - 0
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()

+ 1 - 0
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)

+ 2 - 0
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>

+ 2 - 0
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" .}}