0
이 함수의 else
이 실행되지 않고 if
의 이유는 무엇입니까? 또한 코드가 느리게 실행되는 무언가가 있습니까? 아래는 제 코드입니다.IF 함수가 실행되지 ELSE가 아닌
function SignUserIn() {
// Get elements
const Email = document.getElementById("txtEmail");
const Password = document.getElementById("txtPassword");
// Get email and pass
const email = Email.value;
const password = Password.value;
const auth = firebase.auth();
//Sign In
firebase.auth().signInWithEmailAndPassword(email, password)
.catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
if (errorCode === 'auth/wrong-password' || errorCode === 'auth/invalid-email' || errorCode === 'auth/user-disabled' || errorCode === 'auth/user-not-found') {
window.alert(errorMessage);
document.getElementById("txtPassword").value = "";
}
else {
//Realtime listener
firebase.auth().onAuthStateChanged(frebaseUser => {
sessionStorage.setItem("email", email);
window.alert("You Are Successfully Signed In! Welcome " + email);
window.location = "homepage.html";
});
}
});
}
조건이 충족되지 않을 수 있습니다. –
'console.log (errorCode)'는 무엇을 보여줍니까? – Barmar
@Barmar 로그인 정보가 올바르지 않으면 (예 : 전자 메일 또는 암호가 일치하지 않는 경우) 올바른 오류 메시지 (auth.wrong-password, auth/invalid-email 등) 중 하나가 표시됩니다 if 조건. 그것의 정확한 그 후에 아무것도. – SpiderMonkey