mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-12 10:10:59 +01:00
60 lines
1.8 KiB
Vue
60 lines
1.8 KiB
Vue
<template>
|
|
<form-wrapper :title="$t('auth.forms.reset_password')" :punchline="$t('auth.forms.reset_punchline')">
|
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
|
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" autofocus />
|
|
<form-buttons
|
|
:submitId="'btnSendResetPwd'"
|
|
:isBusy="form.isBusy"
|
|
:caption="$t('auth.forms.send_password_reset_link')"
|
|
:showCancelButton="true"
|
|
cancelLandingView="login" />
|
|
</form>
|
|
<!-- footer -->
|
|
<vue-footer></vue-footer>
|
|
</form-wrapper>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import Form from './../../../components/Form'
|
|
|
|
export default {
|
|
data(){
|
|
return {
|
|
form: new Form({
|
|
email: '',
|
|
})
|
|
}
|
|
},
|
|
methods : {
|
|
handleSubmit(e) {
|
|
e.preventDefault()
|
|
|
|
this.form.post('/user/password/lost', {returnError: true})
|
|
.then(response => {
|
|
|
|
this.$notify({ type: 'is-success', text: response.data.message, duration:-1 })
|
|
})
|
|
.catch(error => {
|
|
if( error.response.data.requestFailed ) {
|
|
|
|
this.$notify({ type: 'is-danger', text: error.response.data.requestFailed, duration:-1 })
|
|
}
|
|
else if( error.response.status !== 422 ) {
|
|
|
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
|
}
|
|
});
|
|
|
|
}
|
|
},
|
|
|
|
beforeRouteLeave (to, from, next) {
|
|
this.$notify({
|
|
clean: true
|
|
})
|
|
|
|
next()
|
|
}
|
|
}
|
|
</script> |