mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 22:17:16 -04:00
Since 07cc454
(ie the switch to Meteor 1.2) we includes the `es5-shim`
polyfill to support methods like `Array.prototype.forEach` in a
consistent way across all supported browsers (IE8+).
MDG recently released a blog post recommending the use of these native
methods instead of underscore [0]. We know follow this recommendation.
This commit also favor some ES6 features (argument defaults,
destructing assignment) in places where we didn’t use them.
[0]: http://info.meteor.com/blog/es2015-get-started
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
const passwordField = AccountsTemplates.removeField('password');
|
|
const emailField = AccountsTemplates.removeField('email');
|
|
AccountsTemplates.addFields([{
|
|
_id: 'username',
|
|
type: 'text',
|
|
displayName: 'username',
|
|
required: true,
|
|
minLength: 2,
|
|
}, emailField, passwordField]);
|
|
|
|
AccountsTemplates.configure({
|
|
defaultLayout: 'userFormsLayout',
|
|
defaultContentRegion: 'content',
|
|
confirmPassword: false,
|
|
enablePasswordChange: true,
|
|
sendVerificationEmail: true,
|
|
showForgotPasswordLink: true,
|
|
onLogoutHook() {
|
|
const homePage = 'home';
|
|
if (FlowRouter.getRouteName() === homePage) {
|
|
FlowRouter.reload();
|
|
} else {
|
|
FlowRouter.go(homePage);
|
|
}
|
|
},
|
|
});
|
|
|
|
['signIn', 'signUp', 'resetPwd', 'forgotPwd', 'enrollAccount'].forEach(
|
|
(routeName) => AccountsTemplates.configureRoute(routeName));
|
|
|
|
// We display the form to change the password in a popup window that already
|
|
// have a title, so we unset the title automatically displayed by useraccounts.
|
|
AccountsTemplates.configure({
|
|
texts: {
|
|
title: {
|
|
changePwd: '',
|
|
},
|
|
},
|
|
});
|
|
|
|
AccountsTemplates.configureRoute('changePwd', {
|
|
redirect() {
|
|
// XXX We should emit a notification once we have a notification system.
|
|
// Currently the user has no indication that his modification has been
|
|
// applied.
|
|
Popup.back();
|
|
},
|
|
});
|