Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <div>
- <div class="loginpanel">
- <div class="icon">
- <h2 class="logintext">Login to Your Account</h2>
- <hr class="loginhr">
- </div>
- <input type="text" id="text" placeholder="Email" v-model="email">
- <input type="password" id="psw" placeholder="Password" v-model="password">
- <button v-on:click="login" class="btn btn-large btn-extended lighten-4 black-text" id="signin">Login</button>
- </div>
- </div>
- </template>
- <script>
- import firebase from 'firebase';
- export default {
- name: 'login',
- data: function() {
- return {
- email: '',
- password: ''
- };
- },
- methods: {
- login: function(e) {
- firebase
- .auth()
- .signInWithEmailAndPassword(this.email, this.password)
- .then(
- user => {
- alert(`You are logged in as ${user.email}`);
- this.$router.go({ path: this.$router.path });
- },
- err => {
- alert(err.message);
- }
- );
- e.preventDefault();
- }
- }
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement