[TYPO3-english] Redirect to login instead of 404 error page if fe_user has no correct permission

Jigal van Hemert jigal.van.hemert at typo3.org
Fri Dec 14 10:36:20 CET 2012


Hi,

On 13-12-2012 19:57, Jan Bartels wrote:
> I think there's no official way to do it. I have written an own
> 404-Handler that parses the error-message. If the string contains
> something with "access" the handler redirects to the login-page. If the
> string is not found, the handler retrieves the 404-page. This approach
> works with internal restricted links as well as with links from extern.

The USER_FUNC handler receives rather detailed information:

array(
   'currentUrl' => [requested uri],
   'reasonText' => [textual explanation],
   'pageAccessFailureReasons' => [array with access information for the 
rootline]
)

The pageAccessFailureReasons array contains the properties which lead to 
the denied access:
array(
   'hidden' => array( [pageId] => TRUE, ... ),
   'starttime' => array( [pageId] => [starttime], ... ),
   'endtime' => array( [pageId] => [endtime], ... ),
   'fe_group' => array( [pageId] => [fe_group], ... )
)

If 'extendToSubpages' was set for a page higher in the rootline the page 
ID of that page is used in the array.

The reasonText can be found in 
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController (previously 
tslib_fe ); search for page(.*)AndExit .

> Maybe you should file a feature-request for the core on forge to support
> separate handlers for 404- and 401-errors in the future.

About 401: "The response MUST include a WWW-Authenticate header field 
containing a challenge applicable to the requested resource."
The normal login in a TYPO3 site is not done by HTTP Authentication.

It would be nice to have more powerful 404 handling. Maybe it can be 
done with an extension. If this extension needs something from the core 
it can always be introduced.

-- 
Jigal van Hemert
TYPO3 Core Team member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-english mailing list