HunchoDevelo HunchoDevelo - 20 days ago 9
Javascript Question

Firebase function is letting Invalid emails to be allowed

I am new to Firebase, sorry if this seems basic

I wrote a segment of code that should register a user. And it does just that, but, I can fill in an email that does not exist.

This is not the full code, just the function that is responsible for this

window.createUser = function (email, password) {
firebase.auth().createUserWithEmailAndPassword(email, password).then(function () {
location.reload();
}).catch(function (error) {
if (document.getElementById("lemail").value == "" && document.getElementById("lpassword").value == "") {
$("#lalert").html("<strong>Oh no! </strong> Looks like the email or password inputs are not filled out!");
$("#lalert").show();

} else {

$("#lalert").html("<strong>Oh no! </strong>" + aTranslate(error.code));
$("#lalert").show();
}
});
}


aTranslate()
is a function that gets the error code and changes it into a customized message

Answer

If an email that doesn't exist is an email that is not real and made up, then Firebase authentication does not check to see whether or not an email is legit or a made up one. You would have to test whether it is a valid email or not by yourself.

Comments