我目前正在開發(fā)一個具有管理儀表板的網(wǎng)站,但我無法登錄。Firebase 配置是從網(wǎng)站復(fù)制的,并且使用電子郵件和密碼激活身份驗證。這是我的代碼: <script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-auth.js"></script> <script> // CONFIG FIREBASE const firebaseConfig = { // Firebase config is copied from the Firebase project }; firebase.initializeApp(firebaseConfig); // WORK ON USER const myButton = document.getElementById('signing'); const emailField = document.getElementById('inputEmail'); const passwordField = document.getElementById('inputPassword'); myButton.addEventListener(`click`, function() { const email = emailField.value; const password = passwordField.value; firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) { const errorCode = error.code; const errorMessage = error.message; alert('Error : ' + errorCode + ' - ' + errorMessage); }); firebase.auth().onAuthStateChanged(function(user) { if (user) { const displayName = user.displayName; const emailU = user.email; alert('Hello ' + displayName + '!'); alert('Your mail is ' + emailU); } else { alert('Not logged !'); } }); }); </script>`對應(yīng)表格的代碼:<form class="form-signin"> <img class="mb-4" src="assets/images/logo.png" alt="" width="72" height="72" /> <h1 class="h3 mb-3 font-weight-normal">Se connecter</h1> <label for="inputEmail" class="sr-only">Email address</label> <input type="email" id="inputEmail" class="form-control" placeholder="Email" required autofocus /> <label for="inputPassword" class="sr-only">Password</label> <input type="password" id="inputPassword" class="form-control" placeholder="Mot de passe" required />
無法連接用戶
神不在的星期二
2023-07-14 16:45:51