This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
<v-col cols="12" class="d-flex d-md-none">
|
||||
<v-img :src="require('../assets/logo.svg')" contain height="64"></v-img>
|
||||
</v-col>
|
||||
<v-col cols="12" md="7" offset-md="3">
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
</v-col>
|
||||
<template v-if="$ay.dev">
|
||||
<v-col cols="12" offset="md-6">
|
||||
<span class="title red--text">DEVELOPMENT MODE</span>
|
||||
@@ -70,11 +73,14 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
input: {
|
||||
username: "manager",
|
||||
password: "l3tm3in"
|
||||
// username: "manager",
|
||||
// password: "l3tm3in"
|
||||
username: "CustomerLimited",
|
||||
password: "CustomerLimited"
|
||||
},
|
||||
errorBadCreds: false,
|
||||
reveal: false
|
||||
reveal: false,
|
||||
formState: { errorBoxMessage: null }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -90,23 +96,34 @@ export default {
|
||||
document.getElementsByName("password")[0].focus();
|
||||
},
|
||||
login() {
|
||||
if (this.input.username != "" && this.input.password != "") {
|
||||
this.errorBadCreds = false;
|
||||
let vm = this;
|
||||
let vm = this;
|
||||
if (vm.input.username != "" && vm.input.password != "") {
|
||||
vm.errorBadCreds = false;
|
||||
|
||||
auth
|
||||
.authenticate(this.input.username, this.input.password)
|
||||
.authenticate(vm.input.username, vm.input.password)
|
||||
.then(() => {
|
||||
vm.$router.push(vm.$store.state.homePage);
|
||||
})
|
||||
.catch(function handleCaughtLoginError(error) {
|
||||
/* xeslint-disable-next-line */
|
||||
//bad creds?
|
||||
if (
|
||||
error.message &&
|
||||
error.message.includes("ErrorUserNotAuthenticated")
|
||||
) {
|
||||
vm.errorBadCreds = true;
|
||||
}
|
||||
//server closed?
|
||||
if (error.code == 2000) {
|
||||
vm.formState.errorBoxMessage = error.message;
|
||||
}
|
||||
|
||||
// {
|
||||
// "code": "2000",
|
||||
// "message": "Testing ops only server state"
|
||||
// }
|
||||
//-----
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user