diff --git a/frontend/src/components/AccessDenied.vue b/frontend/src/components/AccessDenied.vue index f632e23..eb5ca48 100644 --- a/frontend/src/components/AccessDenied.vue +++ b/frontend/src/components/AccessDenied.vue @@ -3,6 +3,7 @@

🔒 Access Denied

+
@@ -10,6 +11,8 @@ diff --git a/frontend/src/components/ProfileView.vue b/frontend/src/components/ProfileView.vue index 76e25bf..5f69788 100644 --- a/frontend/src/components/ProfileView.vue +++ b/frontend/src/components/ProfileView.vue @@ -64,7 +64,7 @@ @@ -100,6 +100,7 @@ import RegistrationLinkModal from '@/components/RegistrationLinkModal.vue' import { useAuthStore } from '@/stores/auth' import { adminUiPath, makeUiHref } from '@/utils/settings' import passkey from '@/utils/passkey' +import { goBack } from '@/utils/helpers' const authStore = useAuthStore() const updateInterval = ref(null) diff --git a/frontend/src/host/HostApp.vue b/frontend/src/host/HostApp.vue index 795984c..ce43d59 100644 --- a/frontend/src/host/HostApp.vue +++ b/frontend/src/host/HostApp.vue @@ -31,7 +31,7 @@ @@ -65,6 +65,7 @@ import { computed, onMounted, ref } from 'vue' import StatusMessage from '@/components/StatusMessage.vue' import UserBasicInfo from '@/components/UserBasicInfo.vue' import { useAuthStore } from '@/stores/auth' +import { goBack } from '@/utils/helpers' const authStore = useAuthStore() const initializing = ref(true) diff --git a/frontend/src/restricted/RestrictedApp.vue b/frontend/src/restricted/RestrictedApp.vue index 8de3faa..4206aab 100644 --- a/frontend/src/restricted/RestrictedApp.vue +++ b/frontend/src/restricted/RestrictedApp.vue @@ -3,7 +3,7 @@ :mode="authMode" @authenticated="handleAuthenticated" @logout="handleLogout" - @back="backNav" + @back="goBack" @home="returnHome" /> @@ -12,6 +12,7 @@ import { computed, onMounted } from 'vue' import RestrictedAuth from '@/components/RestrictedAuth.vue' import { uiBasePath } from '@/utils/settings' +import { goBack } from '@/utils/helpers' const basePath = computed(() => uiBasePath()) @@ -35,22 +36,10 @@ function returnHome() { window.location.href = target } -function backNav() { - try { - if (history.length > 1) { - history.back() - return - } - } catch (_) { /* ignore */ } - returnHome() -} - onMounted(() => { // Handle Escape key to trigger back navigation window.addEventListener('keydown', (event) => { - if (event.key === 'Escape') { - backNav() - } + if (event.key === 'Escape') goBack() }) }) diff --git a/frontend/src/utils/helpers.js b/frontend/src/utils/helpers.js index 200a299..559fa77 100644 --- a/frontend/src/utils/helpers.js +++ b/frontend/src/utils/helpers.js @@ -24,3 +24,5 @@ export function getCookie(name) { const parts = value.split(`; ${name}=`) if (parts.length === 2) return parts.pop().split(';').shift() } + +export const goBack = () => history.back() || window.close()