diff --git a/app/imports/api/users/Invites.js b/app/imports/api/users/Invites.js
index ba621b2d..c3b0fd33 100644
--- a/app/imports/api/users/Invites.js
+++ b/app/imports/api/users/Invites.js
@@ -15,6 +15,7 @@ let InviteSchema = new SimpleSchema({
regEx: SimpleSchema.RegEx.Id,
optional: true,
index: 1,
+ unique: 1,
},
inviteToken: {
type: String,
@@ -25,10 +26,6 @@ let InviteSchema = new SimpleSchema({
isFunded: {
type: Boolean,
},
- isRedundant: {
- type: Boolean,
- optional: true,
- },
// The timestamp of when the invitee was confirmed
// Older invites have priority over newer ones
dateConfirmed: {
@@ -119,14 +116,15 @@ const acceptInviteToken = new ValidatedMethod({
},
}).validator(),
run({inviteToken}) {
- if (this.userId) {
+ if (!this.userId) {
throw new Meteor.Error('Invites.methods.acceptToken.denied',
'You need to be the logged in to accept a token');
}
+ if (Meteor.isClient) return;
let invite = Invites.findOne({inviteToken});
if (!invite){
throw new Meteor.Error('Invites.methods.acceptToken.notFound',
- 'No invite could be found for this token');
+ 'No invite could be found for this link, maybe it has already been claimed');
}
// If the invitee is already filled, fix unexpected case by deleting the token
if (invite.invitee){
@@ -134,7 +132,7 @@ const acceptInviteToken = new ValidatedMethod({
$unset: {inviteToken: 1}
});
throw new Meteor.Error('Invites.methods.acceptToken.alreadyAccepted',
- 'This invite already has an invitee, and shouldn\'t have a token');
+ 'This invite has already been claimed');
}
if (this.userId === invite.inviter){
throw new Meteor.Error('Invites.methods.acceptToken.ownToken',
diff --git a/app/imports/ui/dialogStack/DialogComponentIndex.js b/app/imports/ui/dialogStack/DialogComponentIndex.js
index 66b13b9d..8725a6d6 100644
--- a/app/imports/ui/dialogStack/DialogComponentIndex.js
+++ b/app/imports/ui/dialogStack/DialogComponentIndex.js
@@ -3,6 +3,7 @@ import CreaturePropertyCreationDialog from '/imports/ui/creature/creaturePropert
import CreaturePropertyDialog from '/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue'
import CreaturePropertyFromLibraryDialog from '/imports/ui/creature/creatureProperties/CreaturePropertyFromLibraryDialog.vue'
import DeleteConfirmationDialog from '/imports/ui/dialogStack/DeleteConfirmationDialog.vue';
+import InviteDialog from '/imports/ui/user/InviteDialog.vue';
import LibraryCreationDialog from '/imports/ui/library/LibraryCreationDialog.vue';
import LibraryEditDialog from '/imports/ui/library/LibraryEditDialog.vue';
import LibraryNodeCreationDialog from '/imports/ui/library/LibraryNodeCreationDialog.vue';
@@ -16,6 +17,7 @@ export default {
CreaturePropertyDialog,
CreaturePropertyFromLibraryDialog,
DeleteConfirmationDialog,
+ InviteDialog,
LibraryCreationDialog,
LibraryEditDialog,
LibraryNodeCreationDialog,
diff --git a/app/imports/ui/pages/Account.vue b/app/imports/ui/pages/Account.vue
index 581ee6d4..4b58edfd 100644
--- a/app/imports/ui/pages/Account.vue
+++ b/app/imports/ui/pages/Account.vue
@@ -74,16 +74,48 @@
-
-
+
Sign Out
-
+
+
+
+
+