Skip to content

Commit

Permalink
feat: Implement incomplete route at backend
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 11, 2024
1 parent e618f50 commit a2d1860
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions appinfo/routes/routesPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
// Pages - restricted
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#indexF', 'url' => '/f/', 'verb' => 'GET'],
['name' => 'page#incomplete', 'url' => '/f/incomplete', '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'],
// Pages - public
['name' => 'page#incompleteP', 'url' => '/p/incomplete', 'verb' => 'GET'],
['name' => 'page#sign', 'url' => '/p/sign/{uuid}', 'verb' => 'GET'],
['name' => 'page#sign', 'url' => '/p/sign/{uuid}/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], 'postfix' => 'extra'],
['name' => 'page#signAccountFile', 'url' => '/p/account/files/approve/{uuid}', 'verb' => 'GET'],
Expand Down
14 changes: 14 additions & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ public function indexF(): TemplateResponse {
return $this->index();
}

#[NoAdminRequired]
#[NoCSRFRequired]
public function incomplete(): TemplateResponse {
Util::addScript(Application::APP_ID, 'libresign-main');
$response = new TemplateResponse(Application::APP_ID, 'main', [], TemplateResponse::RENDER_AS_BASE);
return $response;
}

#[PublicPage]
#[NoCSRFRequired]
public function incompleteP(): TemplateResponse {
return $this->incomplete();
}

#[NoAdminRequired]
#[NoCSRFRequired]
#[RequireSetupOk(template: 'main')]
Expand Down
20 changes: 19 additions & 1 deletion src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,24 @@ const router = new Router({
component: () => import('../views/Validation.vue'),
props: true,
},
{
path: '/p/incomplete',
name: 'IncompleteExternal',
beforeEnter: (to, from, next) => {
const action = selectAction(loadState('libresign', 'action', ''), to, from)
if (action !== undefined) {
if (to.name !== 'IncompleteExternal') {
next({
name: action,
params: to.params,
})
return
}
}
next()
},
component: () => import('../views/IncompleteCertification.vue'),
},

// internal pages
{
Expand All @@ -110,7 +128,7 @@ const router = new Router({
beforeEnter: (to, from, next) => {
const action = selectAction(loadState('libresign', 'action', ''), to, from)
if (action !== undefined) {
if (to.name !== 'incomplete') {
if (to.name !== 'Incomplete') {
next({
name: action,
params: to.params,
Expand Down

0 comments on commit a2d1860

Please sign in to comment.