2020-01-14 23:50:07 +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.new_password') }}</h1>
|
|
|
|
<form method="POST">
|
2020-01-14 23:50:07 +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" disabled readonly />
|
2020-01-14 23:50:07 +01:00
|
|
|
</div>
|
2020-01-20 22:51:57 +01:00
|
|
|
<field-error :form="form" field="email" />
|
2020-01-14 23:50:07 +01:00
|
|
|
</div>
|
|
|
|
<div class="field">
|
2020-01-15 11:48:22 +01:00
|
|
|
<label class="label">{{ $t('auth.forms.new_password') }}</label>
|
2020-01-14 23:50:07 +01:00
|
|
|
<div class="control">
|
2020-01-20 22:51:57 +01:00
|
|
|
<input id="password" type="password" class="input" v-model="form.password" required />
|
2020-01-14 23:50:07 +01:00
|
|
|
</div>
|
2020-01-20 22:51:57 +01:00
|
|
|
<field-error :form="form" field="password" />
|
2020-01-14 23:50:07 +01:00
|
|
|
</div>
|
|
|
|
<div class="field">
|
2020-01-15 11:48:22 +01:00
|
|
|
<label class="label">{{ $t('auth.forms.confirm_password') }}</label>
|
2020-01-14 23:50:07 +01:00
|
|
|
<div class="control">
|
2020-01-20 22:51:57 +01:00
|
|
|
<input id="password_confirmation" type="password" class="input" v-model="form.password_confirmation" required />
|
2020-01-14 23:50:07 +01:00
|
|
|
</div>
|
2020-01-20 22:51:57 +01:00
|
|
|
<field-error :form="form" field="password_confirmation" />
|
2020-01-14 23:50:07 +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.change_password') }}</button>
|
2020-01-14 23:50:07 +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 23:50:07 +01:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</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-20 22:51:57 +01:00
|
|
|
errorMessage: '',
|
|
|
|
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()
|
|
|
|
|
2020-01-20 22:51:57 +01:00
|
|
|
this.form.post('/api/password/reset')
|
2020-01-19 22:29:36 +01:00
|
|
|
.then(response => {
|
2020-01-16 22:21:05 +01:00
|
|
|
|
2020-01-15 11:48:22 +01:00
|
|
|
this.$router.go('/');
|
2020-01-19 22:29:36 +01:00
|
|
|
})
|
|
|
|
.catch(error => {
|
2020-01-20 22:51:57 +01:00
|
|
|
if( error.response.data.resetFailed ) {
|
2020-01-15 11:48:22 +01:00
|
|
|
this.errorMessage = error.response.data.resetFailed
|
|
|
|
}
|
2020-01-20 22:51:57 +01:00
|
|
|
else if( error.response.status !== 422 ) {
|
|
|
|
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });
|
2020-01-14 23:50:07 +01:00
|
|
|
}
|
2020-01-19 22:29:36 +01:00
|
|
|
});
|
2020-01-14 23:50:07 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|