diff --git a/client/views/common/css.html b/client/views/common/css.html index 705ab5485..5908872c3 100644 --- a/client/views/common/css.html +++ b/client/views/common/css.html @@ -30,9 +30,14 @@ } .post-content .post-upvote .upvote-link.voted i.icon-check{ /*color: {{getSetting "secondaryColor"}};*/ - } .logo-image a{ - max-height:{{getSetting "logoHeight"}}px; - max-width:{{getSetting "logoWidth"}}px; - } + } + + .logo-image a{ + max-height:{{getSetting "logoHeight"}}px; + max-width:{{getSetting "logoWidth"}}px; + } + + {{hideAuthClass}} + \ No newline at end of file diff --git a/client/views/common/css.js b/client/views/common/css.js index b36bb9272..cf8cbe980 100644 --- a/client/views/common/css.js +++ b/client/views/common/css.js @@ -1,2 +1,27 @@ Template[getTemplate('css')].helpers({ + hideAuthClass: function () { + + var authClass = ''; + var authMethods = getSetting('authMethods', ["email"]); + var selectors = [ + {name: 'email', selector: ".at-pwd-form"}, + {name: 'twitter', selector: "#at-twitter"}, + {name: 'facebook', selector: "#at-facebook"} + ]; + selectors.forEach(function (method) { + // if current method is not one of the enabled auth methods, hide it + if (authMethods.indexOf(method.name) == -1) { + authClass += method.selector + ", "; + } + }); + + // unless we're showing at least one of twitter and facebook AND the password form, + // hide separator + if (authMethods.indexOf('email') == -1 || (authMethods.indexOf('facebook') == -1 && authMethods.indexOf('twitter') == -1)) { + authClass += ".at-sep, "; + } + + return authClass.slice(0, - 2) + "{display:none !important}"; + + } }); \ No newline at end of file diff --git a/collections/settings.js b/collections/settings.js index dcfc2d8d6..0f464bb8c 100644 --- a/collections/settings.js +++ b/collections/settings.js @@ -324,6 +324,30 @@ settingsSchemaObject = { group: 'debug', instructions: 'Enable debug mode for more details console logs' } + }, + authMethods: { + type: [String], + optional: true, + autoform: { + group: 'auth', + editable: true, + noselect: true, + options: [ + { + value: 'email', + label: 'Email/Password' + }, + { + value: 'twitter', + label: 'Twitter' + }, + { + value: 'facebook', + label: 'Facebook' + } + ], + instructions: 'Authentication methods (default to email only)' + } } }; diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 4b3455e68..227e6d47a 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -54,6 +54,7 @@ "debug": "Debug Mode", "fontUrl": "Font URL", "fontFamily": "Font Family", + "authMethods": "Authentication Methods", // Settings Fieldsets "general": "General",