Skip to content

Commit

Permalink
auth methods are now a setting
Browse files Browse the repository at this point in the history
  • Loading branch information
SachaG committed Feb 14, 2015
1 parent a44199e commit c8e1d60
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
13 changes: 9 additions & 4 deletions client/views/common/css.html
Expand Up @@ -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}}

</style>
</template>
25 changes: 25 additions & 0 deletions 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}";

}
});
24 changes: 24 additions & 0 deletions collections/settings.js
Expand Up @@ -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)'
}
}
};

Expand Down
1 change: 1 addition & 0 deletions i18n/en.i18n.json
Expand Up @@ -54,6 +54,7 @@
"debug": "Debug Mode",
"fontUrl": "Font URL",
"fontFamily": "Font Family",
"authMethods": "Authentication Methods",

// Settings Fieldsets
"general": "General",
Expand Down

0 comments on commit c8e1d60

Please sign in to comment.