Add reset password form

This commit is contained in:
Bubka
2020-01-14 23:50:07 +01:00
parent 46de6f1da1
commit 03d1e2aec6
4 changed files with 130 additions and 13 deletions

View File

@ -2,8 +2,8 @@
<div class="section">
<div class="columns is-mobile is-centered">
<div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen is-one-quarter-fullhd">
<h1 class="title">{{ $t('passwords.reset_password') }}</h1>
<form method="POST" action="/login">
<h1 class="title">{{ $t('auth.reset_password') }}</h1>
<form method="POST" action="/password/email">
<div class="field">
<label class="label">{{ $t('auth.forms.email') }}</label>
<div class="control">
@ -13,7 +13,7 @@
</div>
<div class="field is-grouped">
<div class="control">
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('passwords.send_password_reset_link') }}</button>
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.send_password_reset_link') }}</button>
</div>
<div class="control">
<router-link :to="{ name: 'login' }" class="button is-text">{{ $t('commons.cancel') }}</router-link>
@ -22,6 +22,12 @@
</form>
</div>
</div>
<div class="columns is-mobile is-centered" v-if="response">
<div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen is-one-quarter-fullhd">
{{ response }}
</router-link>
</div>
</div>
</div>
</template>
@ -30,7 +36,8 @@
data(){
return {
email : '',
validationErrors: {}
validationErrors: {},
response: ''
}
},
methods : {
@ -41,12 +48,14 @@
email: this.email
})
.then(response => {
alert('email sent')
this.response = response.data.status
})
.catch(error => {
console.log(error.response)
if( error.response.data.errors ) {
this.validationErrors = error.response.data.errors
} else if( error.response.data ) {
this.response = error.response.data.email
}
else {
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });