diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt
index ce878c42..f188a430 100644
--- a/ayanova/devdocs/todo.txt
+++ b/ayanova/devdocs/todo.txt
@@ -49,8 +49,10 @@ CURRENT TODOs
@@@@@@@@@@@ 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.
- 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
diff --git a/ayanova/src/api/authutil.js b/ayanova/src/api/authutil.js
index f7a22b8a..749fe2e3 100644
--- a/ayanova/src/api/authutil.js
+++ b/ayanova/src/api/authutil.js
@@ -4,11 +4,22 @@ import initialize from "./initialize";
export function processLogin(response) {
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?
- if (!response || !response.data || !response.data.token) {
+ if (!response.data || !response.data.token) {
window.$gz.store.commit(
"logItem",
- "auth::processLogin -> response empty"
+ "auth::processLogin -> response contains no data"
);
return reject();
}
diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js
index 451ed651..1d5dc1b2 100644
--- a/ayanova/src/api/translation.js
+++ b/ayanova/src/api/translation.js
@@ -35,6 +35,7 @@ export default {
)
.then(window.$gz.api.status)
.then(window.$gz.api.json)
+ // eslint-disable-next-line
.then((response) => {
window.$gz._.forEach(
response.data,
diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue
index a0719e8f..903e70cc 100644
--- a/ayanova/src/views/login.vue
+++ b/ayanova/src/views/login.vue
@@ -11,6 +11,9 @@
+
+
+
DEVELOPMENT MODE
@@ -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"
+ // }
+ //-----
});
}
}