This commit is contained in:
@@ -49,8 +49,10 @@ CURRENT TODOs
|
|||||||
|
|
||||||
@@@@@@@@@@@ ROADMAP STAGE 2:
|
@@@@@@@@@@@ ROADMAP STAGE 2:
|
||||||
|
|
||||||
|
todo: server state
|
||||||
|
- check server routes, what do they do to take into account server state
|
||||||
|
|
||||||
todo: SERVER STATUS
|
todo: SERVER STATE
|
||||||
- check server status on attempt to login for first time or whatever, it should give a prominent warning if the server is unavailable due to closed for maint or whatever rather than just timing out.
|
- check server status on attempt to login for first time or whatever, it should give a prominent warning if the server is unavailable due to closed for maint or whatever rather than just timing out.
|
||||||
- Also it allows login which is good but it should restrict the UI if it's a fresh login to a closed server rather than just failing to do certain things
|
- Also it allows login which is good but it should restrict the UI if it's a fresh login to a closed server rather than just failing to do certain things
|
||||||
- Maybe overall testing is needed with a closed server just to suss out what to do in the UI for that, we want ops people and admins in there but not other biz users if it's locked out
|
- Maybe overall testing is needed with a closed server just to suss out what to do in the UI for that, we want ops people and admins in there but not other biz users if it's locked out
|
||||||
|
|||||||
@@ -4,11 +4,22 @@ import initialize from "./initialize";
|
|||||||
|
|
||||||
export function processLogin(response) {
|
export function processLogin(response) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
|
//check there is a response of some kind
|
||||||
|
if (!response) {
|
||||||
|
window.$gz.store.commit("logItem", "auth::processLogin -> no response");
|
||||||
|
return reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
//is there an error?
|
||||||
|
if (response.error) {
|
||||||
|
return reject(response.error);
|
||||||
|
}
|
||||||
|
|
||||||
//is token present?
|
//is token present?
|
||||||
if (!response || !response.data || !response.data.token) {
|
if (!response.data || !response.data.token) {
|
||||||
window.$gz.store.commit(
|
window.$gz.store.commit(
|
||||||
"logItem",
|
"logItem",
|
||||||
"auth::processLogin -> response empty"
|
"auth::processLogin -> response contains no data"
|
||||||
);
|
);
|
||||||
return reject();
|
return reject();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export default {
|
|||||||
)
|
)
|
||||||
.then(window.$gz.api.status)
|
.then(window.$gz.api.status)
|
||||||
.then(window.$gz.api.json)
|
.then(window.$gz.api.json)
|
||||||
|
// eslint-disable-next-line
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.$gz._.forEach(
|
window.$gz._.forEach(
|
||||||
response.data,
|
response.data,
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
<v-col cols="12" class="d-flex d-md-none">
|
<v-col cols="12" class="d-flex d-md-none">
|
||||||
<v-img :src="require('../assets/logo.svg')" contain height="64"></v-img>
|
<v-img :src="require('../assets/logo.svg')" contain height="64"></v-img>
|
||||||
</v-col>
|
</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">
|
<template v-if="$ay.dev">
|
||||||
<v-col cols="12" offset="md-6">
|
<v-col cols="12" offset="md-6">
|
||||||
<span class="title red--text">DEVELOPMENT MODE</span>
|
<span class="title red--text">DEVELOPMENT MODE</span>
|
||||||
@@ -70,11 +73,14 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
input: {
|
input: {
|
||||||
username: "manager",
|
// username: "manager",
|
||||||
password: "l3tm3in"
|
// password: "l3tm3in"
|
||||||
|
username: "CustomerLimited",
|
||||||
|
password: "CustomerLimited"
|
||||||
},
|
},
|
||||||
errorBadCreds: false,
|
errorBadCreds: false,
|
||||||
reveal: false
|
reveal: false,
|
||||||
|
formState: { errorBoxMessage: null }
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -90,23 +96,34 @@ export default {
|
|||||||
document.getElementsByName("password")[0].focus();
|
document.getElementsByName("password")[0].focus();
|
||||||
},
|
},
|
||||||
login() {
|
login() {
|
||||||
if (this.input.username != "" && this.input.password != "") {
|
let vm = this;
|
||||||
this.errorBadCreds = false;
|
if (vm.input.username != "" && vm.input.password != "") {
|
||||||
let vm = this;
|
vm.errorBadCreds = false;
|
||||||
|
|
||||||
auth
|
auth
|
||||||
.authenticate(this.input.username, this.input.password)
|
.authenticate(vm.input.username, vm.input.password)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
vm.$router.push(vm.$store.state.homePage);
|
vm.$router.push(vm.$store.state.homePage);
|
||||||
})
|
})
|
||||||
.catch(function handleCaughtLoginError(error) {
|
.catch(function handleCaughtLoginError(error) {
|
||||||
/* xeslint-disable-next-line */
|
/* xeslint-disable-next-line */
|
||||||
|
//bad creds?
|
||||||
if (
|
if (
|
||||||
error.message &&
|
error.message &&
|
||||||
error.message.includes("ErrorUserNotAuthenticated")
|
error.message.includes("ErrorUserNotAuthenticated")
|
||||||
) {
|
) {
|
||||||
vm.errorBadCreds = true;
|
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