summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorguillaume <guillaume.cassou@supinfo.com>2018-07-18 10:07:03 +0200
committerguillaume <guillaume.cassou@supinfo.com>2018-07-18 10:07:03 +0200
commite2ae5d6b8e5d2b8b23ecfb48c54a7a748eb425a6 (patch)
tree14dbe631f08190d49fae077a8fa14d48c1ebd24e /models
parentbf5596b20182628a6a9285c86a239b1f61b96fdf (diff)
downloadwekan-e2ae5d6b8e5d2b8b23ecfb48c54a7a748eb425a6.tar.gz
wekan-e2ae5d6b8e5d2b8b23ecfb48c54a7a748eb425a6.tar.bz2
wekan-e2ae5d6b8e5d2b8b23ecfb48c54a7a748eb425a6.zip
remove invitation code
Diffstat (limited to 'models')
-rw-r--r--models/users.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/models/users.js b/models/users.js
index 31590cea..9d859664 100644
--- a/models/users.js
+++ b/models/users.js
@@ -501,12 +501,13 @@ if (Meteor.isServer) {
} else {
user.profile = {icode: options.profile.invitationcode};
user.profile.boardView = 'board-view-lists';
- }
-
- // Deletes the invitation.
- InvitationCodes.remove(invitationCode._id);
- return user;
+ // Deletes the invitation code after the user was created successfully.
+ setTimeout(Meteor.bindEnvironment(() => {
+ InvitationCodes.remove({'_id': invitationCode._id});
+ }), 200);
+ return user;
+ }
});
}