From 9227bf982781bee89146fb0c95e62875f436c9f4 Mon Sep 17 00:00:00 2001 From: rakesh Date: Tue, 24 Jan 2023 17:21:08 +0530 Subject: [PATCH] fixes --- src/components/gate/ResetPasswordComponent.vue | 10 ++++++++++ src/multipages/gate.routes.js | 2 +- src/services/registration.service.js | 2 +- src/stores/gate/registration.module.js | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/gate/ResetPasswordComponent.vue b/src/components/gate/ResetPasswordComponent.vue index 6b032c1..0f9061b 100644 --- a/src/components/gate/ResetPasswordComponent.vue +++ b/src/components/gate/ResetPasswordComponent.vue @@ -7,6 +7,9 @@ {{resetPasswordError}} {{resetPasswordMessage}} + + + !!v || "Email Id is required", + v => /.+@.+\..+/.test(v) || "Email Id must be valid" + ] }), computed: { ...mapFields([ "resetOne", "resetOne.newPassword", + "resetOne.email", "resetPasswordError", "inProgress", "resetPasswordMessage" @@ -112,8 +120,10 @@ export default { }, created() { this.token = this.$route.params.token; + this.email = this.$route.params.emailId; let userIdAndToken = { token : this.token, + email:this.email } this.$store.dispatch("registration/newResetPassword",{userIdAndToken}); } diff --git a/src/multipages/gate.routes.js b/src/multipages/gate.routes.js index 091e411..f84698a 100644 --- a/src/multipages/gate.routes.js +++ b/src/multipages/gate.routes.js @@ -35,7 +35,7 @@ export default [{ } }, { - path: 'reset-password/:token', + path: 'reset-password/:token/:emailId', name: 'reset-password', component: () => import(/* webpackChunkName: "gateModule" */ '@/routes/gate/reset.password.vue'), meta: { diff --git a/src/services/registration.service.js b/src/services/registration.service.js index 7f5db24..8bcae1f 100644 --- a/src/services/registration.service.js +++ b/src/services/registration.service.js @@ -24,7 +24,7 @@ function doResetPassword(resetOne) { //userId, newPassword, token const requestOptions = { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ "email": "", "resetToken": resetOne.token, "newPassword": resetOne.newPassword }) + body: JSON.stringify({ "email":resetOne.email, "resetToken": resetOne.token, "newPassword": resetOne.newPassword }) }; return fetch(`${vueAppMagenotApiUrl}/rest/crn_retailer/V1/customers/resetPassword`, requestOptions).then(handleResponse); } diff --git a/src/stores/gate/registration.module.js b/src/stores/gate/registration.module.js index 0f566b1..b6627ea 100644 --- a/src/stores/gate/registration.module.js +++ b/src/stores/gate/registration.module.js @@ -115,7 +115,8 @@ export const registration = { newResetPassword({ commit }, { userIdAndToken }) { commit('setResetOne', { "newPassword": "", - "token": userIdAndToken.token + "token": userIdAndToken.token, + "email": userIdAndToken.email }); }, resetPassword: async({ commit, state }) => {