From d5276d5adcd6872bcc75510e131267cba22c3b10 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Thu, 13 Feb 2020 12:42:17 +0100 Subject: [PATCH] Update and test front end email verification --- client/cypress/fixtures/schema_public.json | 11 +++++++++++ client/cypress/integration/email-verification.spec.js | 8 ++++---- client/src/pages/email-verification.vue | 6 +++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/client/cypress/fixtures/schema_public.json b/client/cypress/fixtures/schema_public.json index 25900bc8..03731ef2 100644 --- a/client/cypress/fixtures/schema_public.json +++ b/client/cypress/fixtures/schema_public.json @@ -239,6 +239,16 @@ }, "defaultValue": null }, + { + "name": "userIdInput", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, { "name": "clientMutationId", "description": null, @@ -1489,4 +1499,5 @@ } ] } + } diff --git a/client/cypress/integration/email-verification.spec.js b/client/cypress/integration/email-verification.spec.js index 9e6a4d49..da24dd9c 100644 --- a/client/cypress/integration/email-verification.spec.js +++ b/client/cypress/integration/email-verification.spec.js @@ -23,7 +23,7 @@ describe('Email Verifcation', () => { } }); - cy.visit('/verify-email?confirmation=abcd1234'); + cy.visit('/verify-email?confirmation=abcd1234&userId=12'); // user should be logged in at that stage. As the cookie cannot be set at the right time // we just check if the user gets redirected to the login page as we can't log her in @@ -53,7 +53,7 @@ describe('Email Verifcation', () => { } }); - cy.visit('/verify-email?confirmation=abcd1234'); + cy.visit('/verify-email?confirmation=abcd1234&userId=12'); cy.get('[data-cy="code-nok-msg"]').contains('Der angegebene Verifizierungscode ist falsch oder abgelaufen.'); cy.get('[data-cy="code-ok-msg"]').should('not.exist'); @@ -81,7 +81,7 @@ describe('Email Verifcation', () => { } }); - cy.visit('/verify-email?confirmation=abcd1234'); + cy.visit('/verify-email?confirmation=abcd1234&userId=12'); cy.get('[data-cy="code-nok-msg"]').contains('Ein Fehler ist aufgetreten. Bitte kontaktieren Sie den Administrator.'); }); @@ -108,7 +108,7 @@ describe('Email Verifcation', () => { } }); - cy.visit('/verify-email?confirmation=abcd1234'); + cy.visit('/verify-email?confirmation=abcd1234&userId=12'); // user should be logged in at that stage. As the cookie cannot be set at the right time // we just check if the user gets redirected to the coupon page as we can't log her in diff --git a/client/src/pages/email-verification.vue b/client/src/pages/email-verification.vue index 56a518af..45689c06 100644 --- a/client/src/pages/email-verification.vue +++ b/client/src/pages/email-verification.vue @@ -41,14 +41,14 @@ export default { client: 'publicClient', variables: { input: { - confirmationKeyInput: this.$route.query.confirmation || '' + confirmationKeyInput: this.$route.query.confirmation, + userIdInput: this.$route.query.userId } }, fetchPolicy: 'no-cache' - }).then(data => { + }).then(({data}) => { this.loading = false; - if (data.registration.success) { this.keyValid = true; this.$router.push('/');