Commit 369b8c3b authored by Kevin Ditscheid's avatar Kevin Ditscheid

[BUGFIX] Fix access failure reasons and login redirect handling

parent 8bb495d8
......@@ -165,7 +165,7 @@ class RoutingService {
}
try {
$response = $errorController->pageNotFoundAction($GLOBALS['TYPO3_REQUEST'], 'Page Not Found');
$response = $errorController->pageNotFoundAction($GLOBALS['TYPO3_REQUEST'], 'Page Not Found', $parameters['pageAccessFailureReasons']);
} catch (PageNotFoundException $exception) {
// this can happen if e.g. the wanted error page can't be fetched.
......@@ -277,25 +277,13 @@ class RoutingService {
return '';
}
$uri = $request->getUri();
if ($loginRedirectUrl === '/' || $loginRedirectUrl === $uri->getPath()) {
return $loginRedirectUrl;
}
$loginRedirect = new Uri($loginRedirectUrl);
if ($loginRedirect->getHost() === '') {
$loginRedirect = $loginRedirect->withHost($uri->getHost());
}
if ($loginRedirect->getScheme() === NULL) {
$loginRedirect = $loginRedirect->withScheme($uri->getScheme());
}
if ($loginRedirect->getQuery() === '') {
$loginRedirect = $loginRedirect->withQuery($uri->getQuery());
}
if ($loginRedirect->getFragment() === NULL) {
$loginRedirect = $loginRedirect->withFragment($uri->getFragment());
}
$GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class);
$contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class, $GLOBALS['TSFE']);
$redirectUri = $contentObjectRenderer->typoLink_URL([
'parameter' => $loginRedirectUrl,
'additionalParams' => '&' . $request->getUri()->getQuery()
]);
return (string) $loginRedirect;
return $redirectUri ?? $loginRedirectUrl;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment