summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/users.js')
-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;
+ }
});
}