title: How to display firebase auth/wrong-password as window alert?
body: <p>I'm trying to add an error checker whenever I place an invalid email and/or password. What I want to happen if I provide an invalid email or password the page should provide a window alert about the error.</p>
  
  <p><strong>My .js code</strong></p>
  
  <pre><code>(function(){//initialize the firebase app
      var config = {
                    assume there are credentials here
          }; 
  
          firebase.initializeApp(config);
          var auth = null;
          var loginBtn= document.getElementById('btnLogin');
          firebase.auth.Auth.Persistence.SESSION;
  
      //Login
      loginBtn.addEventListener('click', e =&gt; {
          e.preventDefault();
          if( $('#email').val() != '' &amp;&amp; $('#password').val() != '' ){
          //login the user
          var data = {
              email: $('#email').val(),
              password: $('#password').val()
          };
  
          firebase.auth().signInWithEmailAndPassword(data.email, data.password)
              .then(function(authData) {
              auth = authData;
              })
              .catch(function(error) {
              console.log("Login Failed!", error);
              window.alert("Login Failed!", error);
              });
          }
      });
  })();
  </code></pre>
  
  <p>My issue is that the window alert does not execute. I already tried an else statement it won't work as well.</p>
  
  <p><strong>html code</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;title&gt;Login | DIABEATIS by Team Buendia&lt;/title&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link rel="icon" type="image/png" href="images/icons/diabeatis.jpg" /&gt;
      &lt;link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" /&gt;
      &lt;link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet"&gt;
      &lt;link rel="stylesheet" type="text/css" href="css/util.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="css/main.css"&gt;
      &lt;script src='https://cdn.firebase.com/js/client/2.2.1/firebase.js'&gt;&lt;/script&gt;
      &lt;script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'&gt;&lt;/script&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-app.js" &gt;&lt;/script&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-auth.js"&gt;&lt;/script&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-firestore.js"&gt;&lt;/script&gt; 
      &lt;script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-database.js"&gt;&lt;/script&gt; 
      &lt;script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-storage.js"&gt;&lt;/script&gt; 
  &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="limiter"&gt;
              &lt;div class="container-login100"&gt;
                  &lt;div class="wrap-login100 p-t-30 p-b-20"&gt;
                      &lt;form id="loginForm" method="POST"&gt;
                          &lt;img src="images/icons/diabeatis.jpg" width="70%" style="margin: 0px auto 20px;display: block;" alt="AVATAR"&gt;
                          &lt;span class="login100-form-title p-b-40"&gt;
                          &lt;font face="Montserrat"&gt;By Team Buendia&lt;/font&gt;
                          &lt;/span&gt;
  
                          &lt;div class="wrap-input100 validate-input m-t-25 m-b-35" data-validate="Enter username"&gt;
                              &lt;font face="Montserrat"&gt;Email&lt;/font&gt;
                              &lt;input class="input100" type="text" name="loginEmail" style="font-family:Montserrat;" id="email"&gt;
                              &lt;span class="focus-input100"&gt;&lt;/span&gt;
                          &lt;/div&gt;
  
                          &lt;div class="wrap-input100 validate-input m-b-50" data-validate="Enter password" &gt;
                              &lt;font face="Montserrat"&gt;Password&lt;/font&gt;
                              &lt;input class="input100" type="password" name="loginPassword" id="password"&gt;
                              &lt;span class="focus-input100"&gt;&lt;/span&gt;
                          &lt;/div&gt;
  
                          &lt;button type="submit" class="login100-form-btn" style="background-color:blue; font-family:Montserrat; cursor:pointer; font-weight:bold" id="btnLogin"&gt;Login&lt;/button&gt;
  
                          &lt;ul class="login-more p-t-40"&gt;
                          &lt;font face="Montserrat"&gt;Don't have an account?&lt;/font&gt;
                              &lt;li class="m-b-8"&gt;
                                  &lt;a href="signup.html" class="txt2" style="color:#01703D"&gt;
                                      &lt;font face="Montserrat"&gt;Create Account&lt;/font&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                              &lt;font face="Montserrat"&gt;Are you a doctor? Login here&lt;/font&gt;
                              &lt;li class="m-b-8"&gt;
                                  &lt;a href="" class="txt2" style="color:#01703D"&gt;
                                      &lt;font face="Montserrat"&gt;DIABEATIS for Doctors&lt;/font&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                                  &lt;font face="Montserrat"&gt;By Logging in you agree to our Terms &amp; Conditions, as well as, our privacy and policy&lt;/font&gt;
                                  &lt;br&gt;
                              &lt;li class="m-b-8"&gt;
                                  &lt;a href="toc.html" class="txt2" style="color:#01703D"&gt;
                                      &lt;font face="Montserrat"&gt;Terms &amp; Conditions&lt;/font&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li class="m-b-8"&gt;
                                  &lt;a href="privacypolicy.html" class="txt2" style="color:#01703D"&gt;
                                      &lt;font face="Montserrat"&gt;Privacy and Policy&lt;/font&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;script src="signin.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          firebase.auth().onAuthStateChanged(function(user){
              if(user){
                  window.location.href = "patientDashboard.html";
                  console.log(user);
              }
              else{
                  console.log('no user present');
              }
          });
      &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>