最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Firebase: The email address is already in use by another account. (authemail-already-in-use) - Stack Overflow

programmeradmin2浏览0评论

Firebase: The email address is already in use by another account. (auth/email-already-in-use).

This error is ing from firebase and everything works, but, i would like to diplay error without firebase name there, how can i do that?

Firebase: The email address is already in use by another account. (auth/email-already-in-use).

This error is ing from firebase and everything works, but, i would like to diplay error without firebase name there, how can i do that?

Share Improve this question edited Feb 5, 2022 at 15:04 Doug Stevenson 318k36 gold badges456 silver badges473 bronze badges Recognized by Google Cloud Collective asked Feb 5, 2022 at 8:33 Edin OsmicEdin Osmic 4462 gold badges11 silver badges29 bronze badges 2
  • 3 Wele to Stack Overflow. It is customary to include in your question the code you are working with so that we can see what you have so far and help you proceed with that. Please read: stackoverflow./help/how-to-ask – Doug Stevenson Commented Feb 5, 2022 at 15:05
  • Thank you, i will do better next time. – Edin Osmic Commented Feb 8, 2022 at 11:57
Add a ment  | 

3 Answers 3

Reset to default 3

Capture your error with error code :

if(errorCode == "auth/email-already-in-use"){
    alert("Email already in use")
}
firebase.auth().createUserWithEmailAndPassword(email, password)
  .then((userCredential) => {
    // Signed in 
    var user = userCredential.user;
    // ...
  })
  .catch((error) => {
    if (error.code == "auth/email-already-in-use") {
        alert("The email address is already in use");
    } else if (error.code == "auth/invalid-email") {
        alert("The email address is not valid.");
    } else if (error.code == "auth/operation-not-allowed") {
        alert("Operation not allowed.");
    } else if (error.code == "auth/weak-password") {
        alert("The password is too weak.");
    }
  });

you can just split your error message because the actual message is after the first space character.

error.substring(error.indexOf(' ') + 1);

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论