From cc26d0be94a87fd4b409b4c2497847f6bed29b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Tue, 18 Jun 2019 22:48:53 +0200 Subject: [PATCH] Handle passwordReset response on reset page --- .../components/PasswordReset/VerifyCode.spec.js | 2 +- webapp/components/PasswordReset/VerifyCode.vue | 4 +++- webapp/pages/password-reset.vue | 15 ++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/webapp/components/PasswordReset/VerifyCode.spec.js b/webapp/components/PasswordReset/VerifyCode.spec.js index 217c58ce9..cf12aacac 100644 --- a/webapp/components/PasswordReset/VerifyCode.spec.js +++ b/webapp/components/PasswordReset/VerifyCode.spec.js @@ -80,7 +80,7 @@ describe('VerifyCode ', () => { beforeEach(jest.runAllTimers) it('emits `change-password-sucess`', () => { - expect(wrapper.emitted('change-password-result')).toEqual([['success']]) + expect(wrapper.emitted('passwordResetResponse')).toEqual([['success']]) }) }) }) diff --git a/webapp/components/PasswordReset/VerifyCode.vue b/webapp/components/PasswordReset/VerifyCode.vue index e452d64e8..d53d08bf2 100644 --- a/webapp/components/PasswordReset/VerifyCode.vue +++ b/webapp/components/PasswordReset/VerifyCode.vue @@ -168,7 +168,9 @@ export default { data: { resetPassword }, } = await this.$apollo.mutate({ mutation, variables }) this.changePasswordResult = resetPassword ? 'success' : 'error' - this.$emit('change-password-result', this.changePasswordResult) + setTimeout(() => { + this.$emit('passwordResetResponse', this.changePasswordResult) + }, 3000) this.verification.formData = { code: '', email: '', diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index 0ef12cd32..3c6100430 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -3,8 +3,8 @@ - - + + @@ -19,7 +19,7 @@ export default { layout: 'default', data() { return { - submitted: false, + passwordResetRequested: false } }, components: { @@ -27,8 +27,13 @@ export default { VerifyCode, }, methods: { - handleSubmitted() { - this.submitted = true + handlePasswordResetRequested() { + this.passwordResetRequested = true + }, + handlePasswordResetResponse(response) { + if (response === 'success'){ + this.$router.push('login') + } }, }, }