Project

General

Profile

Actions

Task #104694

closed

[DOCS] Document how to implement a redirect to the restricted page after successful login

Added by Sandra Erbel about 2 months ago. Updated 5 days ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Documentation
Target version:
Start date:
2024-08-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Sprint Focus:

Description

Provide documentation to implement a redirect to the restricted page after a successful frontend login

Problem description

A common use case that a frontend user might expect is that when a frontend user (not logged in yet) tries to access a restricted page, then the user should be redirected to the login page. This is already covered in the documentation.

But after the login you may want to be redirected to the page from where you got initially redirected to and not to the page that you can select in the frontend login plugin. This is not yet covered by the documentation (https://docs.typo3.org/c/typo3/cms-felogin/main/en-us/Examples/Index.html#login-and-back-to-original-page).

I will provide the documentation that this sentence is referring to (Sending those direct visits to a login page is not a job of the felogin plugin, but requires a custom page-not-found handler).

Connections to Torbens issue

Torben Hansen (https://forge.typo3.org/issues/101252) provided a not yet merged (as of the time of this writing) solution for this but in another manner than I want to document about.

He suggests to use the RedirectLoginErrorHandler class in terms of a LoginRedirect errorHandler, but I will document the RedirectLoginErrorHandler in the use of custom PHP 403 errorHandler in the error handling (site settings) which a backend user can provide by its own.

I tried to implement the other way (RedirectLoginErrorHandler class in terms of a LoginRedirect errorHandler) but this didn't work out in a TYPO3 instance with version v11.5.37 - after a successful login we ran into the 403 (The page did not exist or was inaccessible. Reason: ID was not an accessible page) error again. Garvin and me therefore tried the other way and succeeded with small modification of the code in the RedirectLoginErrorHandler class.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #101252: PageErrorHandler for 403 errors with redirect option to login pageClosedTorben Hansen2023-07-05

Actions
Actions

Also available in: Atom PDF