From 0bdee973a05dd4aaaeb112c2111a546a2b5126cc Mon Sep 17 00:00:00 2001 From: Erik Ordway Date: Thu, 23 May 2013 13:44:14 -0700 Subject: [PATCH] allow disabling of local logins. In the instance where an .edu is using cas they may not want a user to be able to log in once the users credentials have been revoked in the system that feeds the CAS authentication server. This is very optional --- .../templates/modal/login.js.handlebars | 52 +++++++++++-------- app/models/site_setting.rb | 3 ++ config/locales/server.en.yml | 2 + 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/modal/login.js.handlebars b/app/assets/javascripts/discourse/templates/modal/login.js.handlebars index 32f55efa98d..d5dee05dae1 100644 --- a/app/assets/javascripts/discourse/templates/modal/login.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/login.js.handlebars @@ -23,30 +23,34 @@ {{/if}} -

{{i18n login.or}}

{{/if}} -
-
- - - - - - - - -
- - - {{textField value=view.loginName placeholderKey="login.email_placeholder" id="login-account-name" autocorrect="off" autocapitalize="off" autofocus="autofocus"}} -
- - - {{textField value=view.loginPassword type="password" id="login-account-password"}}   - {{i18n forgot_password.action}} -
-
-
+ {{#if Discourse.SiteSettings.enable_local_logins}} + {{#if view.hasAtLeastOneLoginButton}} +

{{i18n login.or}}

+ {{/if}} +
+
+ + + + + + + + +
+ + + {{textField value=view.loginName placeholderKey="login.email_placeholder" id="login-account-name" autocorrect="off" autocapitalize="off" autofocus="autofocus"}} +
+ + + {{textField value=view.loginPassword type="password" id="login-account-password"}}   + {{i18n forgot_password.action}} +
+
+
+ {{/if}} {{view.authMessage}}
{{view.alert}}
@@ -54,7 +58,9 @@ {{#if view.authenticate}} {{i18n login.authenticating}} {{/if}} + {{#if Discourse.SiteSettings.enable_local_logins}}   {{i18n create_account.invite}} {{i18n create_account.action}} + {{/if}} diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index 1635b3185eb..9066ae166a9 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -129,6 +129,9 @@ class SiteSetting < ActiveRecord::Base setting(:send_welcome_message, true) + client_setting(:enable_local_logins, true) + client_setting(:enable_local_account_create, true) + client_setting(:enable_google_logins, true) client_setting(:enable_yahoo_logins, true) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 8d07f2d3787..f22d4be7db8 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -493,6 +493,8 @@ en: # TODO: perhaps we need a way of protecting these settings for hosted solution, global settings ... + enable_local_logins: "Enable local authentication" + enable_local_account_create: "Enable local account creation" enable_google_logins: "Enable Google authentication" enable_yahoo_logins: "Enable Yahoo authentication"