2018-11-01 22:34:29 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
2019-10-19 16:27:56 +02:00
|
|
|
<h2 class="title has-text-centered">Reset your password</h2>
|
2018-11-01 22:34:29 +01:00
|
|
|
<div class="box">
|
2019-10-19 16:27:56 +02:00
|
|
|
<form @submit.prevent="submit" v-if="!isSuccess">
|
2018-11-01 22:34:29 +01:00
|
|
|
<div class="field">
|
2019-10-19 16:27:56 +02:00
|
|
|
<label class="label" for="email">E-mail address</label>
|
2018-11-01 22:34:29 +01:00
|
|
|
<div class="control">
|
2020-09-05 22:35:52 +02:00
|
|
|
<input
|
|
|
|
class="input"
|
|
|
|
id="email"
|
|
|
|
name="email"
|
|
|
|
placeholder="e.g. frederic@vikunja.io"
|
|
|
|
required
|
|
|
|
type="email"
|
|
|
|
v-focus
|
|
|
|
v-model="passwordReset.email"/>
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
2020-09-05 22:35:52 +02:00
|
|
|
<button class="button is-primary" type="submit"
|
|
|
|
v-bind:class="{ 'is-loading': passwordResetService.loading}">Send me a password reset
|
|
|
|
link
|
|
|
|
</button>
|
2020-06-17 22:24:37 +02:00
|
|
|
<router-link :to="{ name: 'user.login' }" class="button">Login</router-link>
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-23 18:32:06 +01:00
|
|
|
<div class="notification is-danger" v-if="errorMsg">
|
2020-01-31 16:33:14 +01:00
|
|
|
{{ errorMsg }}
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
|
|
|
</form>
|
2020-09-05 22:35:52 +02:00
|
|
|
<div class="has-text-centered" v-if="isSuccess">
|
2018-11-01 22:34:29 +01:00
|
|
|
<div class="notification is-success">
|
|
|
|
Check your inbox! You should have a mail with instructions on how to reset your password.
|
|
|
|
</div>
|
2020-06-17 22:24:37 +02:00
|
|
|
<router-link :to="{ name: 'user.login' }" class="button is-primary">Login</router-link>
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
2020-07-18 21:39:30 +02:00
|
|
|
<legal/>
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-05 22:35:52 +02:00
|
|
|
import PasswordResetModel from '../../models/passwordReset'
|
|
|
|
import PasswordResetService from '../../services/passwordReset'
|
|
|
|
import Legal from '../../components/misc/legal'
|
2018-11-01 22:34:29 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Legal,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
passwordResetService: PasswordResetService,
|
|
|
|
passwordReset: PasswordResetModel,
|
|
|
|
errorMsg: '',
|
|
|
|
isSuccess: false,
|
2019-03-02 11:25:10 +01:00
|
|
|
}
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.passwordResetService = new PasswordResetService()
|
|
|
|
this.passwordReset = new PasswordResetModel()
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.setTitle('Reset your password')
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit() {
|
|
|
|
this.errorMsg = ''
|
|
|
|
this.passwordResetService.requestResetPassword(this.passwordReset)
|
|
|
|
.then(() => {
|
|
|
|
this.isSuccess = true
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.errorMsg = e.response.data.message
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-11-01 22:34:29 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2020-09-05 22:35:52 +02:00
|
|
|
.button {
|
|
|
|
margin: 0 0.4em 0 0;
|
|
|
|
}
|
2018-11-01 22:34:29 +01:00
|
|
|
</style>
|