Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- btnLogin.addEventListener('click', e =>{
- const email = txtEmail.value;
- const pass = txtPassword.value;
- const auth = firebase.auth();
- const promise = auth.signInWithEmailAndPassword(email,pass);
- promise
- .then(user => window.location.href="http://www.example.com/" + user.uid + "/index.html")
- .catch(e => console.log(e.message));
- })
- firebase.auth().onAuthStateChanged(firebaseUser => {
- if(firebaseUser){
- console.log(firebaseUser);
- }else{
- window.location.href = "http://www.example.com";
- console.log("offline");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement