2020-01-14 17:06:59 +01:00
|
|
|
<template>
|
|
|
|
<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">
|
2020-01-14 23:50:07 +01:00
|
|
|
<h1 class="title">{{ $t('auth.reset_password') }}</h1>
|
|
|
|
<form method="POST" action="/password/email">
|
2020-01-14 17:06:59 +01:00
|
|
|
<div class="field">
|
|
|
|
<label class="label">{{ $t('auth.forms.email') }}</label>
|
|
|
|
<div class="control">
|
|
|
|
<input id="email" type="email" class="input" v-model="email" required autofocus />
|
|
|
|
</div>
|
|
|
|
<p class="help is-danger" v-if="validationErrors.email">{{ validationErrors.email.toString() }}</p>
|
|
|
|
</div>
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
2020-01-14 23:50:07 +01:00
|
|
|
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.send_password_reset_link') }}</button>
|
2020-01-14 17:06:59 +01:00
|
|
|
</div>
|
|
|
|
<div class="control">
|
|
|
|
<router-link :to="{ name: 'login' }" class="button is-text">{{ $t('commons.cancel') }}</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-14 23:50:07 +01:00
|
|
|
<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>
|
2020-01-14 17:06:59 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
email : '',
|
2020-01-14 23:50:07 +01:00
|
|
|
validationErrors: {},
|
|
|
|
response: ''
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods : {
|
|
|
|
handleSubmit(e){
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
axios.post('/api/password/email', {
|
|
|
|
email: this.email
|
|
|
|
})
|
|
|
|
.then(response => {
|
2020-01-14 23:50:07 +01:00
|
|
|
this.response = response.data.status
|
2020-01-14 17:06:59 +01:00
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.log(error.response)
|
|
|
|
if( error.response.data.errors ) {
|
|
|
|
this.validationErrors = error.response.data.errors
|
2020-01-14 23:50:07 +01:00
|
|
|
} else if( error.response.data ) {
|
|
|
|
this.response = error.response.data.email
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|