verification sending fucntion

sending verification on sign up
This commit is contained in:
Jack 2020-07-21 22:50:38 +01:00
parent 7c2dca89c9
commit a6eb637b49

View file

@ -140,6 +140,7 @@ function signUp() {
.collection("users")
.doc(usr.uid)
.set({ name: nname }, { merge: true });
usr.sendEmailVerification();
showNotification("Account created", 2000);
$("#menu .icon-button.account .text").text(nname);
try {
@ -192,6 +193,19 @@ function signOut() {
});
}
function sendVerificationEmail() {
firebase
.auth()
.currentUser.sendEmailVerification()
.then((e) => {
showNotification("Email sent", 3000);
})
.catch((e) => {
showNotification("Error: " + e.message, 3000);
console.error(e.message);
});
}
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
// User is signed in.