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',
|
2014-09-26 17:19:18 +02:00
|
|
|
required: true,
|
2014-09-26 17:21:16 +02:00
|
|
|
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',
|
2014-09-26 17:19:18 +02:00
|
|
|
required: true,
|
2014-09-26 17:21:16 +02:00
|
|
|
minLength: 8,
|
2014-09-26 17:19:18 +02:00
|
|
|
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,
|
2014-09-24 07:35:10 +02:00
|
|
|
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,
|
2014-09-26 11:27:39 +02:00
|
|
|
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
|
|
|
}
|