Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <template>
  2. <div>
  3.  
  4. <div class="loginpanel">
  5. <div class="icon">
  6. <h2 class="logintext">Login to Your Account</h2>
  7. <hr class="loginhr">
  8. </div>
  9.  
  10. <input type="text" id="text" placeholder="Email" v-model="email">
  11. <input type="password" id="psw" placeholder="Password" v-model="password">
  12.  
  13. <button v-on:click="login" class="btn btn-large btn-extended lighten-4 black-text" id="signin">Login</button>
  14.  
  15. </div>
  16. </div>
  17.  
  18.  
  19. </template>
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. <script>
  27. import firebase from 'firebase';
  28. export default {
  29. name: 'login',
  30. data: function() {
  31. return {
  32. email: '',
  33. password: ''
  34. };
  35. },
  36. methods: {
  37. login: function(e) {
  38. firebase
  39. .auth()
  40. .signInWithEmailAndPassword(this.email, this.password)
  41. .then(
  42. user => {
  43. alert(`You are logged in as ${user.email}`);
  44. this.$router.go({ path: this.$router.path });
  45. },
  46. err => {
  47. alert(err.message);
  48. }
  49. );
  50. e.preventDefault();
  51. }
  52. }
  53. };
  54. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement