2020-01-14 23:50:07 +01:00
|
|
|
<template>
|
2020-10-12 10:22:52 +02:00
|
|
|
<form-wrapper :title="$t('auth.forms.new_password')">
|
2020-01-28 15:33:33 +01:00
|
|
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
2020-02-13 12:55:00 +01:00
|
|
|
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" disabled readonly />
|
|
|
|
<form-field :form="form" fieldName="password" inputType="password" :label="$t('auth.forms.new_password')" />
|
|
|
|
<form-field :form="form" fieldName="password_confirmation" inputType="password" :label="$t('auth.forms.confirm_password')" />
|
|
|
|
<form-buttons :isBusy="form.isBusy" :caption="$t('auth.forms.change_password')" :showCancelButton="true" cancelLandingView="login" />
|
2020-01-28 15:33:33 +01:00
|
|
|
</form>
|
|
|
|
</form-wrapper>
|
2020-01-14 23:50:07 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-01-20 22:51:57 +01:00
|
|
|
|
|
|
|
import Form from './../../../components/Form'
|
|
|
|
|
2020-01-14 23:50:07 +01:00
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
2020-01-28 15:33:33 +01:00
|
|
|
success: '',
|
|
|
|
fail: '',
|
2020-01-20 22:51:57 +01:00
|
|
|
form: new Form({
|
|
|
|
email : '',
|
|
|
|
password : '',
|
|
|
|
password_confirmation : '',
|
|
|
|
token: ''
|
|
|
|
})
|
2020-01-14 23:50:07 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created () {
|
2020-01-20 22:51:57 +01:00
|
|
|
this.form.email = this.$route.query.email
|
|
|
|
this.form.token = this.$route.params.token
|
2020-01-14 23:50:07 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
methods : {
|
2020-01-19 22:29:36 +01:00
|
|
|
handleSubmit(e) {
|
2020-01-14 23:50:07 +01:00
|
|
|
e.preventDefault()
|
|
|
|
|
2022-03-24 15:03:45 +01:00
|
|
|
this.form.post('/user/password/reset', {returnError: true})
|
2020-01-19 22:29:36 +01:00
|
|
|
.then(response => {
|
2020-01-16 22:21:05 +01:00
|
|
|
|
2021-10-09 19:23:24 +02:00
|
|
|
this.$notify({ type: 'is-success', text: response.data.message, duration:-1 })
|
2020-01-19 22:29:36 +01:00
|
|
|
})
|
|
|
|
.catch(error => {
|
2020-01-20 22:51:57 +01:00
|
|
|
if( error.response.data.resetFailed ) {
|
2020-10-12 10:22:52 +02:00
|
|
|
|
|
|
|
this.$notify({ type: 'is-danger', text: error.response.data.resetFailed, duration:-1 })
|
2020-01-15 11:48:22 +01:00
|
|
|
}
|
2020-01-20 22:51:57 +01:00
|
|
|
else if( error.response.status !== 422 ) {
|
2020-10-12 10:22:52 +02:00
|
|
|
|
2020-01-21 08:43:11 +01:00
|
|
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
2020-01-14 23:50:07 +01:00
|
|
|
}
|
2020-01-19 22:29:36 +01:00
|
|
|
});
|
2020-01-14 23:50:07 +01:00
|
|
|
}
|
|
|
|
},
|
2020-10-12 10:22:52 +02:00
|
|
|
|
|
|
|
beforeRouteLeave (to, from, next) {
|
|
|
|
this.$notify({
|
|
|
|
clean: true
|
|
|
|
})
|
|
|
|
|
|
|
|
next()
|
|
|
|
}
|
2020-01-14 23:50:07 +01:00
|
|
|
}
|
|
|
|
</script>
|