auth methods are now a setting

This commit is contained in:
Sacha Greif 2015-02-14 10:55:04 +09:00
parent a44199e247
commit c8e1d60811
4 changed files with 59 additions and 4 deletions

View file

@ -30,9 +30,14 @@
} }
.post-content .post-upvote .upvote-link.voted i.icon-check{ .post-content .post-upvote .upvote-link.voted i.icon-check{
/*color: {{getSetting "secondaryColor"}};*/ /*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> </style>
</template> </template>

View file

@ -1,2 +1,27 @@
Template[getTemplate('css')].helpers({ 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}";
}
}); });

View file

@ -324,6 +324,30 @@ settingsSchemaObject = {
group: 'debug', group: 'debug',
instructions: 'Enable debug mode for more details console logs' 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)'
}
} }
}; };

View file

@ -54,6 +54,7 @@
"debug": "Debug Mode", "debug": "Debug Mode",
"fontUrl": "Font URL", "fontUrl": "Font URL",
"fontFamily": "Font Family", "fontFamily": "Font Family",
"authMethods": "Authentication Methods",
// Settings Fieldsets // Settings Fieldsets
"general": "General", "general": "General",