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-15 11:48:22 +01:00
|
|
|
<h1 class="title">{{ $t('auth.forms.reset_password') }}</h1>
|
2020-01-14 23:50:07 +01:00
|
|
|
<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">
|
2020-01-20 22:51:57 +01:00
|
|
|
<input id="email" type="email" class="input" v-model="form.email" required autofocus />
|
2020-01-14 17:06:59 +01:00
|
|
|
</div>
|
2020-01-20 22:51:57 +01:00
|
|
|
<field-error :form="form" field="email" />
|
2020-01-14 17:06:59 +01:00
|
|
|
</div>
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
2020-01-15 11:48:22 +01:00
|
|
|
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.forms.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>
|
2020-01-20 22:51:57 +01:00
|
|
|
<div class="field" v-if="errorMessage">
|
|
|
|
<span class="tag is-danger">
|
|
|
|
{{ errorMessage }}
|
|
|
|
</span>
|
|
|
|
</div>
|
2020-01-14 17:06:59 +01:00
|
|
|
</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 }}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-14 17:06:59 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-01-20 22:51:57 +01:00
|
|
|
|
|
|
|
import Form from './../../../components/Form'
|
|
|
|
|
2020-01-14 17:06:59 +01:00
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
2020-01-15 11:48:22 +01:00
|
|
|
response: '',
|
2020-01-20 22:51:57 +01:00
|
|
|
errorMessage: '',
|
|
|
|
form: new Form({
|
|
|
|
email: '',
|
|
|
|
})
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods : {
|
2020-01-20 22:51:57 +01:00
|
|
|
handleSubmit(e) {
|
2020-01-14 17:06:59 +01:00
|
|
|
e.preventDefault()
|
|
|
|
|
2020-01-20 22:51:57 +01:00
|
|
|
this.form.post('/api/password/email')
|
2020-01-19 22:29:36 +01:00
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
this.response = response.data.status
|
|
|
|
})
|
|
|
|
.catch(error => {
|
2020-01-20 22:51:57 +01:00
|
|
|
if( error.response.data.requestFailed ) {
|
2020-01-15 11:48:22 +01:00
|
|
|
this.errorMessage = error.response.data.requestFailed
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
2020-01-20 22:51:57 +01:00
|
|
|
else if( error.response.status !== 422 ) {
|
2020-01-21 08:43:11 +01:00
|
|
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
2020-01-19 22:29:36 +01:00
|
|
|
});
|
|
|
|
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|