mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Share the useraccounts configuration with the server
The previous users accounts templates configuration only happened on the client, which was wrong and caused some bugs, for instance an invalid URL was generated in the reset password e-mail. Fixes #297
This commit is contained in:
parent
f9cbc1da4c
commit
e551d067b1
1 changed files with 0 additions and 0 deletions
48
config/accounts.js
Normal file
48
config/accounts.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
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();
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue