Vulcan/lib/config/at_config.js

84 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-09-20 14:21:56 +02:00
//////////////////////////////////
// AccountsTemplates configuration
//////////////////////////////////
2015-02-03 10:31:54 +09:00
var removeSpaces = function(value){
return value.replace(" ", "");
};
2014-09-18 11:00:12 +02:00
//Fields
AccountsTemplates.addField({
2014-12-16 09:52:28 +01:00
_id: 'username',
type: 'text',
displayName: 'username',
required: true,
minLength: 3,
2015-02-03 10:31:54 +09:00
errStr: 'error.minChar',
trim: true,
lowercase: true,
transform: removeSpaces
2014-09-18 11:00:12 +02:00
});
2014-09-20 12:52:14 +02:00
AccountsTemplates.removeField('email');
AccountsTemplates.addField({
_id: 'email',
type: 'email',
required: true,
re: /.+@(.+){2,}\.(.+){2,}/,
errStr: 'error.accounts.Invalid email',
trim: true,
2015-02-03 10:31:54 +09:00
lowercase: true,
transform: removeSpaces
2014-09-20 12:52:14 +02:00
});
AccountsTemplates.removeField('password');
AccountsTemplates.addField({
_id: 'password',
type: 'password',
required: true,
minLength: 8,
errStr: 'error.minChar'
2014-09-20 12:52:14 +02:00
});
2015-02-03 10:31:54 +09:00
AccountsTemplates.addField({
_id: 'username_and_email',
type: 'text',
required: true,
displayName: 'usernameOrEmail',
placeholder: 'usernameOrEmail',
trim: true,
lowercase: true,
transform: removeSpaces
});
2014-09-18 11:00:12 +02:00
2014-09-20 14:21:56 +02:00
//Routes
2014-12-16 09:52:28 +01:00
AccountsTemplates.configureRoute('signIn');
2015-02-03 10:31:54 +09:00
AccountsTemplates.configureRoute('signUp');
2014-12-16 09:52:28 +01:00
AccountsTemplates.configureRoute('forgotPwd');
AccountsTemplates.configureRoute('resetPwd');
//AccountsTemplates.configureRoute('changePwd');
//AccountsTemplates.configureRoute('enrollAccount');
//AccountsTemplates.configureRoute('verifyEmail');
2014-09-18 11:00:12 +02:00
2014-09-20 14:21:56 +02:00
2014-09-18 11:00:12 +02:00
// Options
AccountsTemplates.configure({
enablePasswordChange: false,
showForgotPasswordLink: true,
confirmPassword: false,
2014-09-18 11:00:12 +02:00
overrideLoginErrors: true,
2014-09-20 12:52:14 +02:00
negativeFeedback: false,
positiveFeedback: false,
negativeValidation: true,
positiveValidation: true
2014-12-16 09:52:28 +01:00
});
// hack to get signOut route not considered among previous paths
if (Meteor.isClient) {
Meteor.startup(function(){
AccountsTemplates.knownRoutes.push('/sign-out');
});
2015-02-03 10:31:54 +09:00
}