I have a function that enable user to sign up or create an account. It also sends verification after signing up. I only want users whose email were verified to logged in.What would I do?
This is my login function.
function signIn() {
var email = $("#emailtxt").val();
var password = $("#passwordtxt").val();
var auth = firebase.auth();
firebase.auth().signInWithEmailAndPassword(email,
password).then(function(value) {
//NEED TO PULL USER DATA?
var user = firebase.auth().currentUser;
if(user){
console.log(user.uid);
$("#popup").click();
}
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
if (errorCode === 'auth/wrong-password') {
alert('Wrong password.');
} else {
alert(errorMessage);
}
console.log(error);
});
}