From 7bd03e221cbedc6bd499da33720907beffe5779a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Mon, 14 Jul 2014 20:48:00 +0200 Subject: [PATCH] Hide register page link if public registration is disabled --- app/coffee/config.coffee | 1 + app/coffee/modules/auth.coffee | 6 ++++-- app/partials/views/modules/login-form.jade | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/coffee/config.coffee b/app/coffee/config.coffee index fcc145e1..22b48ba3 100644 --- a/app/coffee/config.coffee +++ b/app/coffee/config.coffee @@ -31,6 +31,7 @@ class ConfigService extends taiga.Service "es": "Spanish" "en": "English" } + allowPublicRegistration: false } initialize: (localconfig) -> diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index e087a526..e3a1c720 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -152,8 +152,10 @@ module.service("$tgAuth", AuthService) ## Login Directive ################### -LoginDirective = ($auth, $confirm, $location) -> +LoginDirective = ($auth, $confirm, $location, $config) -> link = ($scope, $el, $attrs) -> + $scope.allowPublicRegistration = $config.get("allowPublicRegistration") + $scope.data = {} form = $el.find("form").checksley() @@ -381,7 +383,7 @@ InvitationDirective = ($auth, $confirm, $location, $params) -> module.directive("tgRegister", ["$tgAuth", "$tgConfirm", RegisterDirective]) -module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$location", LoginDirective]) +module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$location", "$tgConfig", LoginDirective]) module.directive("tgForgotPassword", ["$tgAuth", "$tgConfirm", "$location", ForgotPasswordDirective]) module.directive("tgChangePasswordFromRecovery", ["$tgAuth", "$tgConfirm", "$location", "$routeParams", ChangePasswordFromRecoveryDirective]) diff --git a/app/partials/views/modules/login-form.jade b/app/partials/views/modules/login-form.jade index 62fd7fa3..0819d245 100644 --- a/app/partials/views/modules/login-form.jade +++ b/app/partials/views/modules/login-form.jade @@ -13,6 +13,6 @@ div.login-form-container(tg-login) a.button.button-login.button-gray(href="", ng-click="ctrl.submit()", title="Sign in") Sign in input(type="submit", style="display:none") - p.login-text + p.login-text(ng-if="allowPublicRegistration") span Not registered yet? a(href="", tg-nav="register", title="Register") create your free account here