Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] feat: Implement internal sign page #2684

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions appinfo/routes/routesPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
32 changes: 22 additions & 10 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -169,6 +180,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);
Expand Down
1 change: 1 addition & 0 deletions lib/Helper/JSActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down