From c8b1f4266cfb39ce87d8e57ae4d883b70d13661c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 30 Jul 2020 17:54:27 +0000 Subject: [PATCH] --- ayanova/src/App.vue | 28 ++++++++++++++++++++++++---- ayanova/src/views/login.vue | 3 ++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index ea559fdf..bcc08458 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -324,14 +324,34 @@ export default { //this smells bad but it works vm.$root.$gz = window.$gz; + //direct open path? + let toPath = window.location.pathname; + + if (toPath != undefined && toPath.length > 4 && !toPath.includes("login")) { + //must be at least 4 to be a valid AyaNova url + window.$gz.store.commit( + "logItem", + `App::Mounted - preset path presented: ${toPath}` + ); + } else { + toPath = undefined; + } + //redirect to login if not authenticated if (!vm.$store.state.authenticated) { //If a direct open path was being used but user is not logged in this will catch it //otherwise they will just go on to that path directly - vm.$router.push({ - name: "login", - params: { topath: window.location.pathname } - }); + + if (toPath != undefined) { + vm.$router.push({ + name: "login", + params: { topath: window.location.pathname } + }); + } else { + vm.$router.push({ + name: "login" + }); + } } //RELOAD / REFRESH HANDLING //Restart notification polling due to refresh? diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index b4aaa3fe..ad875974 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -307,7 +307,8 @@ export default { })(); } - if (vm.$route.params.topath != undefined) { + let toPath = vm.$route.params.topath; //set in app.vue::mounted + if (toPath != undefined) { vm.$router.push(vm.$route.params.topath); } else { vm.$router.push(vm.$store.state.homePage);