added passwordreset
This commit is contained in:
parent
1797e0d8c4
commit
f791e14f4a
@ -15,7 +15,7 @@
|
||||
|
||||
<div class="w-full flex flex-wrap justify-between">
|
||||
<input :disabled="disableButtons" type="submit" value="Login" class="btn w-full sm:w-24 mb-1">
|
||||
<button class="hover:underline font-bold w-full sm:w-max sm:ml-auto">Forgot Password?</button>
|
||||
<button @click="forgotPassword" class="hover:underline font-bold w-full sm:w-max sm:ml-auto">Forgot Password?</button>
|
||||
</div>
|
||||
</form>
|
||||
<form v-else @submit.prevent="submitCreateForm" class="flex flex-col">
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
<script setup>
|
||||
import { useToast } from 'vue-toastification'
|
||||
import { createUserWithEmailAndPassword, signInWithEmailAndPassword } from "firebase/auth";
|
||||
import { createUserWithEmailAndPassword, signInWithEmailAndPassword, sendPasswordResetEmail } from "firebase/auth";
|
||||
import { doc, setDoc } from "firebase/firestore";
|
||||
|
||||
|
||||
@ -150,6 +150,21 @@ const submitCreateForm = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const forgotPassword = () => {
|
||||
sendPasswordResetEmail(auth.value, form.value.email)
|
||||
.then(() => {
|
||||
toast.info('Wachtwoord vergeten email verstuurd!')
|
||||
})
|
||||
.catch((error) => {
|
||||
const errorCode = error.code;
|
||||
const errorMessage = error.message;
|
||||
|
||||
console.log(error)
|
||||
|
||||
toast.error('Error tijdens het versturen van het wachtwoord vergeten email')
|
||||
});
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
creatingAccount.value = false
|
||||
form.value = {
|
||||
|
Loading…
Reference in New Issue
Block a user