This commit is contained in:
2019-12-11 21:23:37 +00:00
parent a1755864de
commit a86df67e11
3 changed files with 23 additions and 4 deletions

View File

@@ -47,10 +47,21 @@ CURRENT TODOs
TODO: AUTO-LOGOUT EXPIRED SESSION?
- first off, is this really an issue?
- Right now a user can simply close the browser in the middle of a session, re-open it any amount of time later and it will just keep working, however it might have outdatd cached data from the server
- What about a time limit after which a session needs to login again just to protect the users from themselves?
- Perhaps it can detect a full page refresh (which is what a restart essentially is) and see how long ago it was last active, maybe the time of the last API call to the server and use that info to force re-login.
- planning:
- first off, is this really an issue?
- No, actually it's kind of useful for keeping on working when a server needs a restart or something
- Only real issue is cached data mismatch so perhaps when detected it should toss cached data forcing a reload
- Or is this really an issue either? things cached are form customization and locale text which in the normal course of things won't change much
- Right now a user can simply close the browser in the middle of a session, re-open it any amount of time later and it will just keep working, however it might have outdatd cached data from the server
- What about a time limit after which a session needs to login again just to protect the users from themselves?
- Perhaps it can detect a full page refresh (which is what a restart essentially is) and see how long ago it was last active, maybe the time of the last API call to the server and use that info to force re-login.
- ACTION:
- add code to reliably detect when a user opens the browser or reloads with a session active
- Add code to track last active
- User interacted with server sb good enough
- toss any cached data if it's been more than an hour since the session was last active

View File

@@ -166,6 +166,10 @@ export default {
if (!this.$store.state.authenticated) {
this.$router.push({ name: "login" });
}
//FUTURE: If need to detect a reload, this works reliably
//OK if here then is this a reliable way to detect a reload or refresh or re-open of the app from a closed window but still authenticated?
//console.log("APP.VUE::Mounted=>RELOAD DETECTED?");
},
computed: {
isAuthenticated() {

View File

@@ -83,6 +83,10 @@ function handleError(action, error, route, reject) {
error.message.includes("Network request failed")
) {
window.$gz.store.commit("logItem", "Network error");
window.$gz.eventBus.$emit(
"notify-error",
window.$gz.locale.get("ErrorServerUnresponsive")
);
//note: using locale key in square brackets
return reject("[ErrorServerUnresponsive]");
//throw "Error: unable to contact server";