Skip to content

Commit

Permalink
[BUGFIX] Address TYPO3 v9 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ohader committed Mar 30, 2020
1 parent e8484bd commit e8274b3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
14 changes: 14 additions & 0 deletions Classes/Backend/ConfirmationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ protected function requestAction(ServerRequestInterface $request, ConfirmationBu
return new JsonResponse([], 500);
}

/**
* @todo ext:rsaauth not working yet in TYPO3 v9, extract to optional "controller enhancer"
*/
protected function applyRsaAuth()
{
$isEnabled = ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] ?? '') === 'rsa';
if (!$isEnabled) {
return;
}
$rsaEncryptionEncoder = GeneralUtility::makeInstance(\TYPO3\CMS\Rsaauth\RsaEncryptionEncoder::class);
$rsaEncryptionEncoder->enableRsaEncryption(true);
// PageRender contains JavaScript libs and inline code...
}

protected function verifyAction(ServerRequestInterface $request, ConfirmationBundle $bundle): ResponseInterface
{
$confirmationPassword = (string)($request->getParsedBody()['confirmationPassword'] ?? '');
Expand Down
15 changes: 13 additions & 2 deletions Classes/Scope/CoreRouteHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CoreRouteHandler implements RouteHandlerInterface

public function __construct()
{
// TYPO3 v10
$this->handlers = [
// \TYPO3\CMS\Backend\Controller\EditDocumentController
'/record/edit' => function(Route $route, ServerRequestInterface $request): string {
Expand All @@ -55,16 +56,26 @@ public function __construct()
]);
},
];

// TYPO3 v9
$this->handlers['/user/setup'] = $this->handlers['/module/user/setup'];
}

public function canHandle(ServerRequestInterface $request, Route $route): bool
{
return in_array($route->getPath(), array_keys($this->handlers), true);
$routePath = $this->normalizeRoutePath($route);
return in_array($routePath, array_keys($this->handlers), true);
}

public function resolveMetaData(ServerRequestInterface $request, Route $route): RequestMetaData
{
$returnUrl = $this->handlers[$route->getPath()]($route, $request);
$routePath = $this->normalizeRoutePath($route);
$returnUrl = $this->handlers[$routePath]($route, $request);
return (new RequestMetaData())->withReturnUrl($returnUrl);
}

protected function normalizeRoutePath(Route $route): string
{
return rtrim($route->getPath(), '/');
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TYPO3 extension providing "sudo mode" to mitigate unintended modifications.
> :information_source: **beta** state - feel free to test and provide feedback for this package
* TYPO3 v10 LTS
* TYPO3 v9 LTS
* TYPO3 v9 LTS (`ext:rsaauth` not supported, yet)

## Installation

Expand Down

0 comments on commit e8274b3

Please sign in to comment.