2018-11-01 22:34:29 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h2 class="title">Reset your password</h2>
|
|
|
|
<div class="box">
|
|
|
|
<form id="loginform" @submit.prevent="submit" v-if="!isSuccess">
|
|
|
|
<div class="field">
|
|
|
|
<div class="control">
|
2019-03-02 11:25:10 +01:00
|
|
|
<input v-focus type="text" class="input" name="email" placeholder="Email-Adress" v-model="passwordReset.email" required>
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
2019-03-02 11:25:10 +01:00
|
|
|
<button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': passwordResetService.loading}">Send me a password reset link</button>
|
2018-11-01 22:34:29 +01:00
|
|
|
<router-link :to="{ name: 'login' }" class="button">Login</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="notification is-danger" v-if="error">
|
|
|
|
{{ error }}
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div v-if="isSuccess" class="has-text-centered">
|
|
|
|
<div class="notification is-success">
|
|
|
|
Check your inbox! You should have a mail with instructions on how to reset your password.
|
|
|
|
</div>
|
|
|
|
<router-link :to="{ name: 'login' }" class="button is-primary">Login</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-03-02 11:25:10 +01:00
|
|
|
import PasswordResetModel from '../../models/passwordReset'
|
|
|
|
import PasswordResetService from '../../services/passwordReset'
|
2018-11-01 22:34:29 +01:00
|
|
|
|
2019-03-02 11:25:10 +01:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
passwordResetService: PasswordResetService,
|
|
|
|
passwordReset: PasswordResetModel,
|
|
|
|
error: '',
|
|
|
|
isSuccess: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.passwordResetService = new PasswordResetService()
|
|
|
|
this.passwordReset = new PasswordResetModel()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit() {
|
|
|
|
this.error = ''
|
|
|
|
this.passwordResetService.requestResetPassword(this.passwordReset)
|
|
|
|
.then(() => {
|
2018-11-01 22:34:29 +01:00
|
|
|
this.isSuccess = true
|
2019-03-02 11:25:10 +01:00
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.error = e.response.data.message
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2018-11-01 22:34:29 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.button {
|
|
|
|
margin: 0 0.4em 0 0;
|
|
|
|
}
|
|
|
|
</style>
|