vendredi 11 août 2017

Firebase web login not working

I'm having issues getting this login to work on my website. I have used the firebase sample code but nothing seems to work. The domain is whitelisted and there is not issues flagging on the console. The code works on other pages to sign in users so I dont understand why it isnt working here.

Here is the code:

    <script src="http://ift.tt/2u5rRm5">
    </script>

    <script>
      // Initialize Firebase
      var config = {
        apiKey: "AIzaSyDb7PQjkzYvTZPIFVkBY2NjsjiTTtBMJqM",
        authDomain: "jaunt-ddc86.firebaseapp.com",
        databaseURL: "http://ift.tt/2ux7GOc",
        projectId: "jaunt-ddc86",
        storageBucket: "jaunt-ddc86.appspot.com",
        messagingSenderId: "40972835460"
      };

      firebase.initializeApp(config);

    function handleSignUp() {
      var email = document.getElementById('email').value;
      var password = document.getElementById('password').value;
      if (email.length < 4) {
        alert('Please enter an email address.');
        return;
      }
      if (password.length < 4) {
        alert('Please enter a password.');
        return;
      }

        window.location.replace("http://ift.tt/2vWMUv6");
      // Sign in with email and pass.
      // [START createwithemail]
      firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
        // Handle Errors here.
        var errorCode = error.code;
        var errorMessage = error.message;
        // [START_EXCLUDE]
        if (errorCode == 'auth/weak-password') {
          alert('The password is too weak.');
        } else {
          console.error(error);
        }
        // [END_EXCLUDE]
      });
      // [END createwithemail]
    }
    function sendPasswordReset() {
      var email = document.getElementById('email').value;
      // [START sendpasswordemail]
      firebase.auth().sendPasswordResetEmail(email).then(function() {
        // Password Reset Email Sent!
        // [START_EXCLUDE]
        alert('Password Reset Email Sent!');
        // [END_EXCLUDE]
      }).catch(function(error) {
        // Handle Errors here.
        var errorCode = error.code;
        var errorMessage = error.message;
        // [START_EXCLUDE]
        if (errorCode == 'auth/invalid-email') {
          alert(errorMessage);
        } else if (errorCode == 'auth/user-not-found') {
          alert(errorMessage);
        }
        console.log(error);
        // [END_EXCLUDE]
      });
      // [END sendpasswordemail];
    }
  </script>

  <body>
  <div id="main">
    <section id="landing">
        <div class="layer">
            <div class="outer">
                <div class="middle">
                    <div class="inner">
                        <img src="img/pin.png" alt="Jaunt Map Pin" id="signupMapPin" />
                        <br />
                        <div id="welText">
                            <div class="signup">
                                <h2 class="signup-title">Sign up for Jaunt now!</h2>
                                <br />
                                <input class="mdl-textfield__input" type="text" id="name" name="name" placeholder="Name"/>
                                <br />
                                <input class="mdl-textfield__input" type="text" id="email" name="email" placeholder="Email"/>
                                <br />
                                <input class="mdl-textfield__input" type="password" id="password" name="password" placeholder="Password"/>
                                <br />
                                <!--<a href="comingsoon.html">-->
                                <button disabled class="mdl-button mdl-js-button mdl-button--raised" id="quickstart-sign-in" name="signin">
                                    Sign In
                                </button>
                                <button class="mdl-button mdl-js-button mdl-button--raised" id="quickstart-sign-up" name="signup">
                                    Sign Up
                                </button>
                                <!--</a>-->
                                <br /><br />
                                <button class="mdl-button mdl-js-button mdl-button--raised" id="quickstart-password-reset" name="verify-email">Reset Your Password</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
    </section>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="http://ift.tt/1XwG72U"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </div>
  </body>
</html>




Aucun commentaire:

Enregistrer un commentaire