mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Handle passwordReset response on reset page
This commit is contained in:
parent
506fe0fe94
commit
cc26d0be94
@ -80,7 +80,7 @@ describe('VerifyCode ', () => {
|
|||||||
beforeEach(jest.runAllTimers)
|
beforeEach(jest.runAllTimers)
|
||||||
|
|
||||||
it('emits `change-password-sucess`', () => {
|
it('emits `change-password-sucess`', () => {
|
||||||
expect(wrapper.emitted('change-password-result')).toEqual([['success']])
|
expect(wrapper.emitted('passwordResetResponse')).toEqual([['success']])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -168,7 +168,9 @@ export default {
|
|||||||
data: { resetPassword },
|
data: { resetPassword },
|
||||||
} = await this.$apollo.mutate({ mutation, variables })
|
} = await this.$apollo.mutate({ mutation, variables })
|
||||||
this.changePasswordResult = resetPassword ? 'success' : 'error'
|
this.changePasswordResult = resetPassword ? 'success' : 'error'
|
||||||
this.$emit('change-password-result', this.changePasswordResult)
|
setTimeout(() => {
|
||||||
|
this.$emit('passwordResetResponse', this.changePasswordResult)
|
||||||
|
}, 3000)
|
||||||
this.verification.formData = {
|
this.verification.formData = {
|
||||||
code: '',
|
code: '',
|
||||||
email: '',
|
email: '',
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
<ds-flex>
|
<ds-flex>
|
||||||
<ds-flex-item :width="{ base: '100%' }" centered>
|
<ds-flex-item :width="{ base: '100%' }" centered>
|
||||||
<ds-space style="text-align: center;" margin-top="small" margin-bottom="xxx-small" centered>
|
<ds-space style="text-align: center;" margin-top="small" margin-bottom="xxx-small" centered>
|
||||||
<password-reset @handleSubmitted="handleSubmitted" v-if="!submitted" />
|
<password-reset @handleSubmitted="handlePasswordResetRequested" v-if="!passwordResetRequested" />
|
||||||
<verify-code v-else />
|
<verify-code v-else @passwordResetResponse="handlePasswordResetResponse" />
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
@ -19,7 +19,7 @@ export default {
|
|||||||
layout: 'default',
|
layout: 'default',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
submitted: false,
|
passwordResetRequested: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@ -27,8 +27,13 @@ export default {
|
|||||||
VerifyCode,
|
VerifyCode,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSubmitted() {
|
handlePasswordResetRequested() {
|
||||||
this.submitted = true
|
this.passwordResetRequested = true
|
||||||
|
},
|
||||||
|
handlePasswordResetResponse(response) {
|
||||||
|
if (response === 'success'){
|
||||||
|
this.$router.push('login')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user