<script>
function save_user()
{
const uid = document.getElementById('user_id');
const userpwd = document.getElementById('user_pwd');
const btnregister=document.getElementById('btn-action');
//btnregister.addEventListener('click', e=>
//{
const email=uid.value;
const pass=userpwd.value;
firebase.auth().signInWithEmailAndPassword(email, pass).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
console.log(error.Message);
});
firebase.auth().onAuthStateChanged(function(user) {
if(user) {
window.location='userpage.html';
}
});
}
</script>
<link href="page2.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="bg">
<img src="images/5.jpg" alt="">
</div>
<div class="loginbox">
<img src="images/logo.jpg" class="user"/>
<form action="" method="post">
<p>Email</p>
<input type="text" name="" placeholder="Enter Email" id="user_id"/>
<p>Password</p>
<input type="password" name="" placeholder="......" id="user_pwd"/>
</br>
</br>
</br>
<input type="button" name="" value="Sign In" id="btn-action" onclick="save_user();">
<a href="#">Forgot Password</a>
<a href="Register.html">Register</a>
</form>
</div>
</body>
</html>
Need help with Firebase authentication on the sign-in page? Want to display an error message when a user is not found in Firebase authentication.