From bdf77f699faf3aca4035f37104e073d08ae4c976 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 7 Jan 2022 17:42:56 +0100 Subject: [PATCH 1/4] switch password-text by checkmail and reset --- frontend/src/views/Pages/ResetPassword.vue | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index 3e6aef339..9c3c2da7c 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -5,10 +5,10 @@
-

{{ $t('settings.password.reset') }}

+

{{ $t(displaySetup.authenticated) }}

- {{ $t('settings.password.reset-password.text') }} + {{ $t(displaySetup.notAuthenticated) }}
@@ -49,14 +49,14 @@ import { setPassword } from '../../graphql/mutations' const textFields = { reset: { - authenticated: 'settings.password.reset-password.text', - notAuthenticated: 'settings.password.not-authenticated', - button: 'settings.password.reset', + authenticated: 'settings.password.change-password', + notAuthenticated: 'settings.password.reset-password.text', + button: 'settings.password.change-password', linkTo: '/login', }, checkEmail: { - authenticated: 'settings.password.set-password.text', - notAuthenticated: 'settings.password.not-authenticated', + authenticated: 'settings.password.set', + notAuthenticated: 'settings.password.set-password.text', button: 'settings.password.set', linkTo: '/login', }, @@ -103,11 +103,16 @@ export default { } }) }, - setDisplaySetup() { - if (!this.$route.params.comingFrom) { + setDisplaySetup(from) { + console.log('this.$route > ', this.$route.path) + + if (this.$route.path.includes('checkEmail')) { + this.displaySetup = textFields.checkEmail + console.log('this.displaySetup checkmail> ', this.displaySetup) + } + if (this.$route.path.includes('reset')) { this.displaySetup = textFields.reset - } else { - this.displaySetup = textFields[this.$route.params.comingFrom] + console.log('this.displaySetup reset> ', this.displaySetup) } }, }, From aa80f0f21a967f77d5c87863290c17fa414f8a2a Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 7 Jan 2022 17:43:49 +0100 Subject: [PATCH 2/4] yarn lint --fix --- frontend/src/views/Pages/ResetPassword.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index 9c3c2da7c..84bc6e83b 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -108,7 +108,7 @@ export default { if (this.$route.path.includes('checkEmail')) { this.displaySetup = textFields.checkEmail - console.log('this.displaySetup checkmail> ', this.displaySetup) + console.log('this.displaySetup checkmail> ', this.displaySetup) } if (this.$route.path.includes('reset')) { this.displaySetup = textFields.reset From d70ce5ed0056fb9ce09cd38dfbe48430e6e60a07 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 7 Jan 2022 17:45:33 +0100 Subject: [PATCH 3/4] remove console states. yarn lint --- frontend/src/views/Pages/ResetPassword.vue | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index 84bc6e83b..c227eeabe 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -104,15 +104,11 @@ export default { }) }, setDisplaySetup(from) { - console.log('this.$route > ', this.$route.path) - if (this.$route.path.includes('checkEmail')) { this.displaySetup = textFields.checkEmail - console.log('this.displaySetup checkmail> ', this.displaySetup) } if (this.$route.path.includes('reset')) { this.displaySetup = textFields.reset - console.log('this.displaySetup reset> ', this.displaySetup) } }, }, From fd409252cbb49a3d0273f799e85afa766e0ad69c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 10 Jan 2022 10:45:41 +0100 Subject: [PATCH 4/4] get the test working --- frontend/src/views/Pages/ResetPassword.spec.js | 3 +++ frontend/src/views/Pages/ResetPassword.vue | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/Pages/ResetPassword.spec.js b/frontend/src/views/Pages/ResetPassword.spec.js index f3bbc7334..e28d16c3e 100644 --- a/frontend/src/views/Pages/ResetPassword.spec.js +++ b/frontend/src/views/Pages/ResetPassword.spec.js @@ -28,6 +28,9 @@ const createMockObject = (comingFrom) => { optin: '123', comingFrom, }, + path: { + includes: (t) => t, + }, }, $toasted: { global: { diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index c227eeabe..05d8a0f6e 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -95,15 +95,12 @@ export default { this.$router.push('/thx/reset') }) .catch((error) => { - if (error.message.includes('Code is older than 10 minutes')) { - this.$toasted.global.error(error.message) + this.$toasted.global.error(error.message) + if (error.message.includes('Code is older than 10 minutes')) this.$router.push('/password/reset') - } else { - this.$toasted.global.error(error.message) - } }) }, - setDisplaySetup(from) { + setDisplaySetup() { if (this.$route.path.includes('checkEmail')) { this.displaySetup = textFields.checkEmail }