From 4241af0b2141b8fd785f47a22eff9a3b81ff7b69 Mon Sep 17 00:00:00 2001 From: Matteo Cominetti Date: Wed, 7 Apr 2021 16:57:30 +0100 Subject: [PATCH 1/2] fix(server): checks if invite is valid and returns proper error when not, partly fixes #163 --- packages/server/modules/serverinvites/services/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/modules/serverinvites/services/index.js b/packages/server/modules/serverinvites/services/index.js index 2278a80ef..7757cbb50 100644 --- a/packages/server/modules/serverinvites/services/index.js +++ b/packages/server/modules/serverinvites/services/index.js @@ -100,7 +100,7 @@ This email was sent from ${serverInfo.name} at ${process.env.CANONICAL_URL}, dep async validateInvite( { email, id } ) { const invite = await module.exports.getInviteById( { id } ) - return invite.email === email + return invite && invite.email === email }, async useInvite( { id, email } ) { From 81dd64151753cf5d0c3ea6fc6ec580b78ccc9e51 Mon Sep 17 00:00:00 2001 From: Matteo Cominetti Date: Wed, 7 Apr 2021 18:20:37 +0100 Subject: [PATCH 2/2] feat(frontend): improves invite dialog --- .../components/dialogs/ServerInviteDialog.vue | 19 +++++----------- .../components/dialogs/StreamInviteDialog.vue | 22 +++++++------------ .../components/dialogs/StreamShareDialog.vue | 12 +++++----- packages/frontend/src/views/Auth.vue | 6 ++++- 4 files changed, 25 insertions(+), 34 deletions(-) diff --git a/packages/frontend/src/components/dialogs/ServerInviteDialog.vue b/packages/frontend/src/components/dialogs/ServerInviteDialog.vue index 962724a0a..b44551b03 100644 --- a/packages/frontend/src/components/dialogs/ServerInviteDialog.vue +++ b/packages/frontend/src/components/dialogs/ServerInviteDialog.vue @@ -2,22 +2,14 @@
- Send a server invite + Send a server invite {{ error }} - + Great! An invite link has been sent. -
- Send another one?
- + We will send an invite link for this server to the email below. You can also add a personal message if you want to. @@ -72,15 +64,16 @@ export default { }, showDialog() { this.clear() + this.email = null + this.message = 'Hey, join this Speckle Server!' } }, methods: { clear() { this.error = null this.showError = false - this.email = null this.success = false - this.message = 'Hey, join this Speckle Server!' + this.$refs.form.resetValidation() }, async sendInvite() { if (!this.$refs.form.validate()) return diff --git a/packages/frontend/src/components/dialogs/StreamInviteDialog.vue b/packages/frontend/src/components/dialogs/StreamInviteDialog.vue index 5ecf61fcc..5c6b252eb 100644 --- a/packages/frontend/src/components/dialogs/StreamInviteDialog.vue +++ b/packages/frontend/src/components/dialogs/StreamInviteDialog.vue @@ -2,26 +2,19 @@
- Send a stream invite + Send a stream invite {{ error }} Great! An invite link has been sent. -
- Send another one?
- + We will send an invite link for this server to the email below and once your guest will - accept the invite, they will be granted access to this stream. You can also add a - personal message if you want to. + accept the invite, + they will be granted access to this stream + . You can also add a personal message if you want to. - No users found. Note: you can search by name and email. - - Hint: use the button below to send an invite! - + + No users found. Note: you can search by name and email. + @@ -59,10 +58,11 @@ - + Existing collaborators - +

This stream has no collaborators.

+ diff --git a/packages/frontend/src/views/Auth.vue b/packages/frontend/src/views/Auth.vue index 0d7211523..9ac2d2c38 100644 --- a/packages/frontend/src/views/Auth.vue +++ b/packages/frontend/src/views/Auth.vue @@ -7,7 +7,11 @@ -

+