Luego de mucho batallar hemos hallado la solución de este enigma que muchos usuarios de este sitio presentan. Si deseas compartir algo más no dejes de compartir tu comentario.
Ejemplo: cómo hacer que un sistema de inicio de sesión funcione usando código
<!DOCTYPE html><html><head><title>Login</title><script>
firebase.initializeApp(firebaseConfig);const auth = firebase.auth();functionsignUp()var email = document.getElementById("email");var password = document.getElementById("password");const promise = auth.createUserWithEmailAndPassword(email.value, password.value);
promise.catch(e=>alert(e.message));alert("Signed Up");functionsignIn()var email = document.getElementById("email");var password = document.getElementById("password");const promise = auth.signInWithEmailAndPassword(email.value, password.value);
promise.catch(e=>alert(e.message));functionsignOut()
auth.signOut();alert("Signed Out");
auth.onAuthStateChanged(function(user)if(user)var email = user.email;alert("Signed in as "+ email);//Take user to a different or home page//is signed inelsealert("No Active User");//no user is signed in);g
</script><style type="text/css">
body
background-color:#55d6aa;
h1
background-color:#ff4d4d;margin:10px auto;
text-align: center;color: white;#formContainer
background-color: white;
box-shadow:012px 16px 0rgba(0,0,0,0.24),017px 50px 0rgba(0,0,0,0.19);width:25%;height:45;margin:10px auto;#headerwidth:100%;height:10px;background: black;#emailwidth:70%;height:40px;display:block;margin:25px auto;border: none;outline: none;
border-bottom:2px solid black;#passwordwidth:70%;height:40px;display: block;margin:10px auto;border: none;outline: none;
border-bottom:2px solid black;#signUp
background-color:#ff4d4d;color: white;border: none;
font-weight: bold;padding:15px 32px;
border-radius:10px;
text-align: center;
text-decoration: none;display: inline-block;
font-size:13px;
margin-top:20px;
margin-left:50px;#signIn
background-color:#32ff7e;color: white;
font-weight: bold;border: none;padding:15px 35px;
border-radius:10px;
text-align: center;
text-decoration: none;
font-size:13px
#signOut
background-color:#FFA500;color: white;border: none;padding:12px 32px;
border-radius:10px;
text-align: center;
text-decoration: none;display: inline-block;
font-size:13px;
margin-top:9px;
margin-left:74px;
font-weight: bold;button: hover
box-shadow:012px 16px 0rgba(0,0,0,0.24),07px 50px 0rgba(0,0,0,0,.19);</style></head><body><h1>Login Here</h1><div id="formContainer"><div id="header"></div><input type="email" placeholder="Email" id="email"><input type="password" placeholder="Password" id="password"><button onclick="signUp()" id="signUp"> Sign Up </button><button onclick="signIn()" id="signIn"> Sign In </button><button onclick="signOut()" id="signOut"> Sign Out </button>Continue</a></body></html>
Recuerda que puedes dar recomendación a este tutorial si te valió la pena.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)