Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. btnLogin.addEventListener('click', e =>{
  2. const email = txtEmail.value;
  3. const pass = txtPassword.value;
  4. const auth = firebase.auth();
  5. const promise = auth.signInWithEmailAndPassword(email,pass);
  6. promise
  7. .then(user => window.location.href="http://www.example.com/" + user.uid + "/index.html")
  8. .catch(e => console.log(e.message));
  9. })
  10.  
  11. firebase.auth().onAuthStateChanged(firebaseUser => {
  12. if(firebaseUser){
  13. console.log(firebaseUser);
  14. }else{
  15. window.location.href = "http://www.example.com";
  16. console.log("offline");
  17. }
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement