diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 1640ec531d..0188f2301e 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -276,6 +276,7 @@ public function signPdf(string $uuid): TemplateResponse { #[RequireSignRequestUuid] #[FrontpageRoute(verb: 'GET', url: '/p/sign/{uuid}')] public function sign(string $uuid): TemplateResponse { + $this->throwIfValidationPageNotAccessible(); $this->initialState->provideInitialState('action', JSActions::ACTION_SIGN); $this->initialState->provideInitialState('config', $this->accountService->getConfig($this->userSession->getUser()) diff --git a/src/helpers/SelectAction.js b/src/helpers/SelectAction.js index 4f56034bf7..d31808b1cd 100644 --- a/src/helpers/SelectAction.js +++ b/src/helpers/SelectAction.js @@ -55,6 +55,9 @@ export const selectAction = (action, to, from) => { case 5000: // ACTION_INCOMPLETE_SETUP return 'Incomplete' + external default: + if (loadState('libresign', 'error', false)) { + return 'DefaultPageError' + external + } break } } diff --git a/src/router/router.js b/src/router/router.js index a838c465a9..62237d17c8 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -205,22 +205,24 @@ const router = new Router({ }) router.beforeEach((to, from, next) => { + const actionElement = document.querySelector('#initial-state-libresign-action') + let action + if (actionElement) { + action = selectAction(loadState('libresign', 'action', ''), to, from) + document.querySelector('#initial-state-libresign-action')?.remove() + } if (Object.hasOwn(to, 'name') && typeof to.name === 'string' && !to.name.endsWith('External') && isExternal(to, from)) { next({ name: to.name + 'External', params: to.params, }) + } else if (action !== undefined) { + next({ + name: action, + params: to.params, + }) } else { - const action = selectAction(loadState('libresign', 'action', ''), to, from) - if (action !== undefined) { - document.querySelector('#initial-state-libresign-action').remove() - next({ - name: action, - params: to.params, - }) - } else { - next() - } + next() } }) diff --git a/src/views/DefaultPageError.vue b/src/views/DefaultPageError.vue index adbf3605ed..3bad5dc0e9 100644 --- a/src/views/DefaultPageError.vue +++ b/src/views/DefaultPageError.vue @@ -25,15 +25,13 @@
-

{{ code || '404' }}

+

404

- {{ message || t('libresign', 'Page not found') }} + {{ t('libresign', 'Page not found') }}

-

{{ paragth }}

- -

- {{ error }} -

+

{{ paragrath }}

+ + {{ error }}
@@ -53,8 +51,8 @@ export default { data() { return { - paragth: t('libresign', 'Sorry but the page you are looking for does not exist, has been removed, moved or is temporarily unavailable.'), - errors: loadState('libresign', 'errors', []), + paragrath: t('libresign', 'Sorry but the page you are looking for does not exist, has been removed, moved or is temporarily unavailable.'), + error: loadState('libresign', 'error', {})?.message, } },