diff --git a/appinfo/routes/routesPageController.php b/appinfo/routes/routesPageController.php index cd50379d94..60a8b70d28 100644 --- a/appinfo/routes/routesPageController.php +++ b/appinfo/routes/routesPageController.php @@ -9,6 +9,8 @@ // Pages - restricted ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'page#indexF', 'url' => '/f/', 'verb' => 'GET'], + ['name' => 'page#signFPath', 'url' => '/f/sign/{uuid}/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], 'postfix' => 'extra'], + ['name' => 'page#signF', 'url' => '/f/sign/{uuid}', 'verb' => 'GET'], ['name' => 'page#indexFPath', 'url' => '/f/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], 'postfix' => 'front'], ['name' => 'page#getPdfFile', 'url' => '/pdf/{uuid}', 'verb' => 'GET'], ['name' => 'page#resetPassword', 'url' => '/reset-password', 'verb' => 'GET'], diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 4f20bd81d8..0d2e6d259b 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -130,25 +130,36 @@ public function indexFPath(): TemplateResponse { return $this->index(); } - /** - * Show signature page - */ #[NoAdminRequired] #[NoCSRFRequired] #[RequireSetupOk] #[PublicPage] #[RequireSignRequestUuid] - public function sign($uuid): TemplateResponse { + public function signF(string $uuid): TemplateResponse { + $this->initialState->provideInitialState('action', JSActions::ACTION_SIGN_INTERNAL); + return $this->index(); + } + + #[NoAdminRequired] + #[NoCSRFRequired] + #[RequireSetupOk] + #[PublicPage] + #[RequireSignRequestUuid] + public function signFPath(string $uuid): TemplateResponse { + $this->initialState->provideInitialState('action', JSActions::ACTION_SIGN_INTERNAL); + return $this->index(); + } + + #[NoAdminRequired] + #[NoCSRFRequired] + #[RequireSetupOk] + #[PublicPage] + #[RequireSignRequestUuid] + public function sign(string $uuid): TemplateResponse { $this->initialState->provideInitialState('action', JSActions::ACTION_SIGN); $this->initialState->provideInitialState('config', $this->accountService->getConfig($this->userSession->getUser()) ); - $this->initialState->provideInitialState('signer', - $this->signFileService->getSignerData( - $this->userSession->getUser(), - $this->getSignRequestEntity(), - ) - ); $this->initialState->provideInitialState('filename', $this->getFileEntity()->getName()); $file = $this->fileService ->setFile($this->getFileEntity()) @@ -170,6 +181,7 @@ public function sign($uuid): TemplateResponse { $this->initialState->provideInitialState('pdf', $this->signFileService->getFileUrl('url', $this->getFileEntity(), $this->getNextcloudFile(), $uuid) ); + $this->initialState->provideInitialState('nodeId', $this->getFileEntity()->getNodeId()); Util::addScript(Application::APP_ID, 'libresign-external'); $response = new TemplateResponse(Application::APP_ID, 'external', [], TemplateResponse::RENDER_AS_BASE); diff --git a/lib/Helper/JSActions.php b/lib/Helper/JSActions.php index d573a3eb32..ff0285e5f4 100644 --- a/lib/Helper/JSActions.php +++ b/lib/Helper/JSActions.php @@ -29,6 +29,7 @@ final class JSActions { public const ACTION_CREATE_ACCOUNT = 1500; public const ACTION_DO_NOTHING = 2000; public const ACTION_SIGN = 2500; + public const ACTION_SIGN_INTERNAL = 2625; public const ACTION_SIGN_ACCOUNT_FILE = 2750; public const ACTION_SHOW_ERROR = 3000; public const ACTION_SIGNED = 3500;