mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 13:55:01 +02:00
Add forgot password form
This commit is contained in:
58
resources/js/views/auth/password/Request.vue
Normal file
58
resources/js/views/auth/password/Request.vue
Normal file
@ -0,0 +1,58 @@
|
||||
<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">
|
||||
<h1 class="title">{{ $t('passwords.reset_password') }}</h1>
|
||||
<form method="POST" action="/login">
|
||||
<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">
|
||||
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('passwords.send_password_reset_link') }}</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<router-link :to="{ name: 'login' }" class="button is-text">{{ $t('commons.cancel') }}</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
email : '',
|
||||
validationErrors: {}
|
||||
}
|
||||
},
|
||||
methods : {
|
||||
handleSubmit(e){
|
||||
e.preventDefault()
|
||||
|
||||
axios.post('/api/password/email', {
|
||||
email: this.email
|
||||
})
|
||||
.then(response => {
|
||||
alert('email sent')
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.response)
|
||||
if( error.response.data.errors ) {
|
||||
this.validationErrors = error.response.data.errors
|
||||
}
|
||||
else {
|
||||
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user