Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Login.vue
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
<script> | <script> | ||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
email: '', | email: '', | ||||
password: '', | password: '', | ||||
secondFactor: '', | secondFactor: '' | ||||
loginError: false | |||||
} | } | ||||
}, | }, | ||||
methods: { | methods: { | ||||
submitLogin() { | submitLogin() { | ||||
this.loginError = false | |||||
this.$root.clearFormValidation($('form.form-signin')) | this.$root.clearFormValidation($('form.form-signin')) | ||||
axios.post('/api/auth/login', { | axios.post('/api/auth/login', { | ||||
email: this.email, | email: this.email, | ||||
password: this.password, | password: this.password, | ||||
secondfactor: this.secondFactor | secondfactor: this.secondFactor | ||||
}).then(response => { | }).then(response => { | ||||
// login user and redirect to dashboard | // login user and redirect to dashboard | ||||
this.$root.loginUser(response.data.access_token) | this.$root.loginUser(response.data.access_token) | ||||
}).catch(error => { | }) | ||||
this.loginError = true | |||||
}); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |