summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-11-02 18:47:06 -0800
committerMaxime Quandalle <maxime@quandalle.com>2015-11-02 18:47:06 -0800
commite551d067b1ff85b9095952059ab8d6cb6dc3a4f1 (patch)
tree9a131782dc15989f92c035ac908b9fa57d569586 /config
parentf9cbc1da4c1729d62b8c7dbbb7586dc95537b3c4 (diff)
downloadwekan-e551d067b1ff85b9095952059ab8d6cb6dc3a4f1.tar.gz
wekan-e551d067b1ff85b9095952059ab8d6cb6dc3a4f1.tar.bz2
wekan-e551d067b1ff85b9095952059ab8d6cb6dc3a4f1.zip
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
Diffstat (limited to 'config')
-rw-r--r--config/accounts.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/config/accounts.js b/config/accounts.js
new file mode 100644
index 00000000..d475e6b2
--- /dev/null
+++ b/config/accounts.js
@@ -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();
+ },
+});