Guest User

Untitled

a guest
May 28th, 2018
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. register() {
  2. var email = '';
  3. var password = '';
  4.  
  5. this.firebase.auth().createUserWithEmailAndPassword(email, password)
  6. .then(function (response) {
  7. // successful register
  8. })
  9. .catch(function (e) {
  10. // register failure
  11. })
  12. }
  13.  
  14. /***************************************************************/
  15.  
  16. login() {
  17. var email = '';
  18. var password = '';
  19.  
  20. this.firebase.auth().signInWithEmailAndPassword(email, password)
  21. .then(function (response) {
  22. // success
  23. })
  24. .catch(function () {
  25. // failure
  26. });
  27. }
  28.  
  29.  
  30.  
  31. /***************************************************************/
  32. // get current auth user
  33.  
  34. var user = firebase.auth().currentUser;
  35.  
  36. if (user) {
  37. // User is signed in.
  38. } else {
  39. // No user is signed in.
  40. }
Add Comment
Please, Sign In to add comment