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)
|
||||
|
||||
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 },
|
||||
} = 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: '',
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
<ds-flex>
|
||||
<ds-flex-item :width="{ base: '100%' }" centered>
|
||||
<ds-space style="text-align: center;" margin-top="small" margin-bottom="xxx-small" centered>
|
||||
<password-reset @handleSubmitted="handleSubmitted" v-if="!submitted" />
|
||||
<verify-code v-else />
|
||||
<password-reset @handleSubmitted="handlePasswordResetRequested" v-if="!passwordResetRequested" />
|
||||
<verify-code v-else @passwordResetResponse="handlePasswordResetResponse" />
|
||||
</ds-space>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
@ -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')
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user