TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:17 +02:00
commit 629541cb4c
86 changed files with 5360 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
.. include:: /Includes.rst.txt
.. _configuration:
=============
Configuration
=============
All configuration options are available in the FlexForm, as settings of the
site set and as TypoScript setup.
The settings are interpreted in the following order, the last one takes
precedence:
.. include:: _SettingsOrder.rst.txt
.. toctree::
:caption: Topics
:glob:
:titlesonly:
*
@@ -0,0 +1,24 @@
.. include:: /Includes.rst.txt
.. _settings-editor:
===============
Settings editor
===============
When the :ref:`site set for the frontend login <configuration-site-set>` is included,
the settings for EXT:felogin become available in the editor.
You can find the available site settings in module
:guilabel:`Sites > Setup > Settings`
You can change individual settings here. If the site settings are writable
you can hit the :guilabel:`Save` button and the settings will be written
directly to the site settings.
If the settings are not writable you can click the :guilabel:`YAML export`
button to export the settings. These can then be added by a developer with
sufficient rights.
The available settings are also described in detail in
:ref:`configuration-site-set-settings`.
+111
View File
@@ -0,0 +1,111 @@
:navigation-title: Site Sets
.. include:: /Includes.rst.txt
.. _configuration-site-sets-include:
============================================
Site set configuration of the Frontend Login
============================================
.. versionadded:: 13.1
Site sets were added.
The system extension :composer:`typo3/cms-felogin` provides the site
set "Frontend Login".
The different methods of setting are taking precedence in the following order:
.. include:: _SettingsOrder.rst.txt
.. contents::
:caption: Content on this page
:depth: 1
.. _configuration-site-set:
Include the site set
====================
Include the site set "Frontend Login" via the :ref:`site set in the site
configuration <t3coreapi:site-sets>` or the custom
:ref:`site package's site set <t3sitepackage:site_set>`.
.. figure:: /Images/SiteSet.png
Add the site set "Frontend Login"
This will change your site configuration file as follows:
.. literalinclude:: _site_config.diff
:caption: config/sites/my-site/config.yaml (diff)
If your site has a custom :ref:`site package <t3sitepackage:start>`, you
can also add the "Frontend Login" set as dependency in your site set's configuration:
.. literalinclude:: _site_package_set.diff
:caption: EXT:my_site_package/Configuration/Sets/MySite/config.yaml (diff)
.. _configuration-site-set-settings:
Settings for the "Frontend Login" site set
==========================================
.. versionadded:: 13.1
These settings were added with the site sets in TYPO3 v13.1.
See also: :ref:`configuration-examples-felogin-pid`.
If you plan to migrate from TypoScript setup settings to site settings see
:ref:`configuration-migration`.
These settings can be adjusted in the :ref:`settings-editor`.
.. typo3:site-set-settings:: PROJECT:/Configuration/Sets/Felogin/settings.definitions.yaml
:name: felogin
:type:
:Label: max=36
:caption: Settings of "Frontend Login"
.. _configuration-migration:
Migration from TypoScript setup settings to site settings
=========================================================
The site settings are named like the TypoScript constants used before
site sets. However the TypoScript constants are not always named the same
like the :ref:`TypoScript setup settings <plugin-tx-felogin-login>`.
For each :ref:`TypoScript setup / FlexForm setting <typo3/cms-felogin:plugin-tx-felogin-login>`
we list the corresponding site set setting in the overview table of the configuration values.
For example, the setting :confval:`felogin.pid <felogin-felogin-pid>` sets
setting :ref:`pages <pages>`.
Bear that in mind when migrating from TypoScript setup to site set settings.
.. _configuration-examples-felogin-pid:
Example: Set the user storage page using the site set settings
==============================================================
After you :ref:`included the site set <configuration-site-set>` you can use
the :ref:`site set settings <configuration-site-set-settings>` to configure
the frontend login plugin's behaviour and layout site-wide.
See also :ref:`Adding site settings <t3coreapi:sitehandling-settings-add>`.
You can add the settings to your :ref:`Site settings <t3coreapi:sitehandling-settings>`
or to the settings of your
:ref:`custom site package extension <t3sitepackage:start>`.
To add the settings to your site settings, edit the file
:file:`config/sites/<my_site>/settings.yaml` in Composer-based installations
or :file:`typo3conf/sites/<my_site>/settings.yaml` in legacy installations. If
the file does not exist yet, create one. Use the setting
:confval:`felogin.pid <felogin-felogin-pid>` to set the storage folder. If
its subfolders should also be included, additionally use setting
:confval:`felogin.recursive <felogin-felogin-recursive>`.
.. literalinclude:: _settings.yaml
:caption: config/sites/<my_site>/settings.yaml | typo3conf/sites/<my_site>/settings.yaml
+293
View File
@@ -0,0 +1,293 @@
:navigation-title: TypoScript
.. include:: /Includes.rst.txt
.. _configuration-typoscript:
==============================================
TypoScript configuration of the Frontend Login
==============================================
.. contents::
:caption: Content on this page
:depth: 1
.. _plugin-tx-felogin-login:
TypoScript setup / FlexForm settings
====================================
Most of these plugin settings can be set with the following methods, the top
bottom most taking precedence:
.. include:: _SettingsOrder.rst.txt
See also :ref:`configuration-examples-flexform`.
.. confval-menu::
:name: typoscript
:display: table
:type:
:Site set setting:
.. _showforgotpassword:
.. confval:: showForgotPassword
:name: typoscript-showForgotPassword
:type: bool
If set, the section in the template to display the link to the forgot
password dialogue is visible.
.. important::
Be aware that having this option disabled also prevents the plugin to
display the forgot password form. For instance if you access the link
directly.
.. _showpermalogin:
.. confval:: showPermaLogin
:name: typoscript-showPermaLogin
:type: bool
If set, the section in the template to display the option to remember
the login (with a cookie) is visible.
.. _showlogoutformafterlogin:
.. confval:: showLogoutFormAfterLogin
:name: typoscript-showLogoutFormAfterLogin
:type: bool
If set, the logout form will be displayed immediately after successful
login.
.. note::
Setting this option will disable the redirect options!
Instead of redirecting the plugin will show the logout form.
.. _pages:
.. confval:: pages
:name: typoscript-pages
:type: string
:Site set setting: :confval:`felogin.pid <felogin-felogin-pid>`
:TypoScript Constant: {$styles.content.loginform.pid}
Define the User Storage Page with the Website User Records, using a
comma separated list or a single value (page id).
.. _recursive:
.. confval:: recursive
:name: typoscript-recursive
:type: int
:Site set setting: :confval:`felogin.recursive <felogin-felogin-recursive>`
:TypoScript Constant: {$styles.content.loginform.recursive}
If set, also any subfolders of the User Storage Page will be used
at configured recursive levels
.. _redirectmode:
.. confval:: redirectMode
:name: typoscript-redirectMode
:type: string
:Site set setting: :confval:`felogin.redirectMode <felogin-felogin-redirectmode>`
:TypoScript Constant: {$styles.content.loginform.redirectMode}
Comma separated list of redirect modes. Possible values:
``groupLogin``, ``userLogin``, ``login``, ``getpost``, ``referer``,
``refererDomains``, ``loginError``, ``logout``
See section on redirect modes for details.
.. _redirectfirstmethod:
.. confval:: redirectFirstMethod
:name: typoscript-redirectFirstMethod
:type: bool
:Site set setting: :confval:`felogin.redirectFirstMethod <felogin-felogin-redirectfirstmethod>`
:TypoScript Constant: {$styles.content.loginform.redirectFirstMethod}
If set the first method from redirectMode which is possible will be
used
.. _redirectpagelogin:
.. confval:: redirectPageLogin
:name: typoscript-redirectPageLogin
:type: integer
:Site set setting: :confval:`felogin.redirectPageLogin <felogin-felogin-redirectpagelogin>`
:TypoScript Constant: {$styles.content.loginform.redirectPageLogin}
Page id to redirect to after Login
.. _redirectpageloginerror:
.. confval:: redirectPageLoginError
:name: typoscript-redirectPageLoginError
:type: integer
:Site set setting: :confval:`felogin.redirectPageLoginError <felogin-felogin-redirectpageloginerror>`
:TypoScript Constant: {$styles.content.loginform.redirectPageLoginError}
Page id to redirect to after Login Error
.. _redirectpagelogout:
.. confval:: redirectPageLogout
:name: typoscript-redirectPageLogout
:type: integer
:Site set setting:
:TypoScript Constant: {$styles.content.loginform.redirectPageLogout}
Page id to redirect to after Logout
.. _redirectdisable:
.. confval:: redirectDisable
:name: typoscript-redirectDisable
:type: bool
:Site set setting: :confval:`felogin.redirectPageLogout <felogin-felogin-redirectpagelogout>`
:TypoScript Constant: {$styles.content.loginform.redirectDisable}
If set redirecting is disabled
.. _dateformat:
.. confval:: dateFormat
:name: typoscript-dateFormat
:type: date-conf
:Site set setting: :confval:`felogin.dateFormat <felogin-felogin-dateformat>`
:TypoScript Constant: Y-m-d H:i
Format for the link is valid until message (forgot password email)
.. _email-from:
.. confval:: email_from
:name: typoscript-email-from
:type: string
Email address used as sender of the change password emails
.. _email-fromname:
.. confval:: email_fromName
:name: typoscript-email-fromName
:type: string
Name used as sender of the change password emails
.. confval:: email
:name: typoscript-email
.. confval:: email.templateName
:name: typoscript-email.templateName
:type: string
:Site set setting: :confval:`felogin.email.templateName <felogin-felogin-email-templatename>`
:TypoScript Constant: {$styles.content.loginform.email.templateName}
Template name for emails. Plaintext emails get the .txt file extension.
.. confval:: email.layoutRootPaths
:name: typoscript-email.layoutRootPaths
:type: array
:Site set setting: :confval:`felogin.email.templateRootPath <felogin-felogin-email-templaterootpath>`
:TypoScript Constant: {$styles.content.loginform.email.layoutRootPath}
Path to layout directory used for emails
.. confval:: email.templateRootPaths
:name: typoscript-email.templateRootPaths
:type: array
:Site set setting: :confval:`felogin.email.templateRootPath <felogin-felogin-email-templaterootpath>`
:TypoScript Constant: {$styles.content.loginform.email.templateRootPaths}
Path to template directory used for emails
.. confval:: email.partialRootPaths
:name: typoscript-email.partialRootPaths
:type: array
:Site set setting: :confval:`felogin.email.partialRootPath <felogin-felogin-email-partialrootpath>`
:TypoScript Constant: {$styles.content.loginform.email.partialRootPaths}
Path to partial directory used for emails
.. confval:: forgotLinkHashValidTime
:name: typoscript-forgotLinkHashValidTime
:type: integer
:Site set setting: :confval:`felogin.forgotLinkHashValidTime <felogin-felogin-forgotlinkhashvalidtime>`
:TypoScript Constant: {$styles.content.loginform.forgotLinkHashValidTime}
Time in hours how long the link for forgot password is valid
.. _domains:
.. confval:: domains
:name: typoscript-domains
:type: string
Comma separated list of domains which are allowed for the referrer
redirect mode
.. _configuration-examples-typoscript-constant:
Example: Set the default storage page via TypoScript constant
=============================================================
You can use the :ref:`TypoScript provider <t3coreapi:site-sets-typoscript>`
or other means of :ref:`setting the TypoScript constants <t3tsref:using-and-setting>`.
.. versionchanged:: 13.1
It is recommended to use the :ref:`configuration-site-set-settings`
instead, as TypoScript constants will be phased out in the future.
.. literalinclude:: _constants.typoscript
:caption: config/sites/MySite/constants.typoscript
.. _configuration-examples-typoscript:
Example: Set the default storage page via TypoScript setup
==========================================================
In order to set the default storage page to a more dynamic value, use
the TypoScript setup. Use the :ref:`TypoScript provider <t3coreapi:site-sets-typoscript>`
or other means of ref:`setting the TypoScript setup <t3tsref:using-and-setting>`.
.. literalinclude:: _setup.typoscript
:caption: config/sites/MySite/constants.typoscript
.. _configuration-examples-flexform:
Example: Override the default storage page in the plugin's FlexForm
===================================================================
If you set any FlexForm setting within the content element representing the
plugin to a **non-empty value** it will override any other setting not matter if it
is made via site settings, TypoScript constant ot TypoScript setup. Empty values
take no effect if a default was set by other means.
In the backend module :guilabel:`Content > Layout` edit the content element containing
the login form. Go to tab :guilabel:`Plugin` and sub tab :guilabel:`General`.
You should see a form similar to the following:
.. figure:: /Images/GeneralSettings.png
:alt: A screenshot showing the "General" tab of the plugin settings
Settings in the tab :guilabel:`General` of the plugin tab
Choose the desired page or pages in the field with label
:guilabel:`User Storage Page` (key :confval:`settings.pages <typoscript-pages>`).
.. tip::
It is sometimes hard to determine, which label in the FlexForm corresponds
to which key in the :ref:`FlexForm reference <plugin-tx-felogin-login>`.
Turn on the :confval:`backend debug mode <t3coreapi:globals-typo3-conf-vars-be-debug>`
to get a visual hint in the backend for the keys of the FlexForm field.
.. figure:: /Images/FlexFormKey.png
:alt: A screenshot showing FlexForm Field with key `settings.pages`
The corresponding FlexForm field :confval:`settings.pages <typoscript-pages>`
in backend debug mode.
@@ -0,0 +1,5 @@
* The corresponding :ref:`site set setting <configuration-site-set-settings>`
* The corresponding :ref:`TypoScript constant <configuration-examples-typoscript-constant>`
* Value set in :ref:`TypoScript setup <t3tsref:using-and-setting>` in the
scope :ref:`plugin.tx_felogin_login.settings <plugin-tx-felogin-login>`
* Setting from the :ref:`FlexForm of the plugin <plugin-tx-felogin-login>`
@@ -0,0 +1,4 @@
styles.content.loginform {
pid = 42
recursive = 255
}
@@ -0,0 +1,4 @@
felogin:
pid: 42
recursive: 255
@@ -0,0 +1,5 @@
[{$tx_my_extension.settings.feature1Enabled} == 1]
plugin.tx_felogin_login.settings.pid = 123
[ELSE]
plugin.tx_felogin_login.settings.pid = 42
[END]
@@ -0,0 +1,5 @@
base: 'https://example.com/'
rootPageId: 1
dependencies:
+ - typo3/felogin
- typo3/fluid-styled-content-css
@@ -0,0 +1,9 @@
name: my-vendor/my-site-package
label: My Site Package Set
settings:
website:
background:
color: '#386492'
dependencies:
+ - typo3/felogin
- typo3/fluid-styled-content-css
+60
View File
@@ -0,0 +1,60 @@
.. include:: /Includes.rst.txt
.. _psr14events:
=============
PSR-14 events
=============
The following PSR-14 events are available to extend the extension:
AfterUserLoggedInEvent
======================
Trigger any kind of action when a frontend user has been successfully logged in.
:ref:`More details <t3coreapi:AfterUserLoggedInEvent>`
BeforeRedirectEvent
===================
Notification before a redirect is made.
:ref:`More details <t3coreapi:BeforeRedirectEvent>`
LoginConfirmedEvent
===================
A notification when a log in has successfully arrived at the plugin, via the
view and the controller, multiple information can be overridden in event
listeners. :ref:`More details <t3coreapi:LoginConfirmedEvent>`
LoginErrorOccurredEvent
=======================
A notification if something went wrong while trying to log in a user.
:ref:`More details <t3coreapi:LoginErrorOccurredEvent>`
LogoutConfirmedEvent
====================
A notification when a log out has successfully arrived at the plugin, via
the view and the controller, multiple information can be overridden in
event listeners. :ref:`More details <t3coreapi:LogoutConfirmedEvent>`
ModifyLoginFormViewEvent
========================
Allows to inject custom variables into the login form.
:ref:`More details <t3coreapi:ModifyLoginFormViewEvent>`
PasswordChangeEvent
===================
Event that contains information about the password which was set,
and is about to be stored in the database.
:ref:`More details <t3coreapi:PasswordChangeEvent>`
SendRecoveryEmailEvent
======================
Event that contains the email to be sent to the user when they request a
new password. :ref:`More details <t3coreapi:SendRecoveryEmailEvent>`
+199
View File
@@ -0,0 +1,199 @@
.. include:: /Includes.rst.txt
.. _examples:
========
Examples
========
In this section some common situations are described:
.. contents::
:local:
.. _login-and-back-to-original-page:
Send visitors to login page and redirect to original page
=========================================================
A common situation is that visitors who go to a page with access
restrictions should go to a login page first and after logging in
should be send back to the page they originally requested.
Assume we have a login page with id `2`.
Using TypoScript we can still display links to access restricted pages
and send visitors to the login page:
.. code-block:: typoscript
config {
typolinkLinkAccessRestrictedPages = 2
typolinkLinkAccessRestrictedPages_addParams = &return_url=###RETURN_URL###
}
On the login page the login form must be configured to redirect to the
original page:
.. code-block:: typoscript
plugin.tx_felogin_login.settings.redirectMode = getpost
(This option can also be set in the flexform configuration of the
felogin content element)
If visitors will directly enter the URL of an access restricted page
they will be sent to the first page in the rootline to which they have
access. Sending those direct visits to a login page is not a job of
the felogin plugin, but requires a custom page-not-found handler. In this sense,
we refer to :ref:`felogin-how-to-implement-403redirect-error-handler`.
.. _login-link-visibility:
Login link visible when not logged in and logout link visible when logged in
============================================================================
Again TypoScript will help you out. The page with the login form has
id=2:
.. code-block:: typoscript
10 = TEXT
10 {
value = Login
typolink.parameter = 2
}
[frontend.user.isLoggedIn]
10.value = Logout
10.typolink.additionalParams = &logintype=logout
[end]
Of course there can be solutions with :typoscript:`HMENU` items, etc.
.. _felogin-how-to-implement-403redirect-error-handler:
Custom error handler implementation for 403 redirects
=====================================================
This section explains how to utilize a custom error handler
to catch 403 restricted page errors and allow to forward
to a login form, and then redirect back to the originating
page after successful login.
.. rst-class:: bignums
#. You need the following site settings in the error handling
.. figure:: ../Images/felogin_site_settings_error_handling.png
:caption: Error Handling tab of site configuration module
:class: with-shadow
:guilabel:`Error Handling` tab of Site Configuration module
There you add the custom 403 error handler and configure
the error handler, you create in the following steps.
.. todo:: Future TYPO3 versions may do this automatically
see https://review.typo3.org/c/Packages/TYPO3.CMS/+/81945
.. seealso::
:ref:`Error handling in site configuration <t3coreapi:sitehandling-errorHandling>`
#. Look up the page ID where a login form (like with EXT:felogin) is placed
This page ID is needed in the following step, so that the error
handler will know, where to forward an unauthenticated user to, so
that a login can be performed.
Ideally, this should be done by configuring a page ID via the
site settings, and referring back to a named ID. See
:ref:`PHP API: accessing site configuration <t3coreapi:sitehandling-php-api>`
for more information. For reduced complexity, this example uses
a hard-coded page ID.
#. Create a new error handler :file:`RedirectLoginErrorHandler.php`
Create a PHP error handler class like the following in a custom
extension, like your own :ref:`sitepackage <t3sitepackage:start>`:
.. literalinclude:: _RedirectLoginErrorHandler.php
:caption: EXT:my_sitepackage/Classes/Error/PageErrorHandler/RedirectLoginErrorHandler.php
:language: php
Adapt the constant :php:`PAGE_ID_LOGIN_FORM` to match the
page ID from the previous step.
Since there is no proper way how to do it otherwise, we put in the page ID
of the login form hard-coded into the file :file:`RedirectLoginErrorHandler.php`
and define a constant :php:`PAGE_ID_LOGIN_FORM` for it. In the example
above, this is set to `656`.
#. In your EXT:felogin plugin, make sure you selected "Defined by GET/POST
Parameters" as first redirect mode
.. figure:: ../Images/SettingsRedirectCustomErrorHandler.png
:caption: Plugin > Redirects tab of Login Form content element
:class: with-shadow
:guilabel:`Plugin > Redirects` tab of :guilabel:`Login Form` content element
You need to configure the login form that receives your redirect in a
way, that allows to evaluate submitted URL parameters. In `EXT:felogin`,
this is achieved via this :guilabel:`Redirect Mode` (which can also be set
through TypoScript configuration, see :confval:`redirectMode <typoscript-redirectmode>`.
Your login form will probably also need to define a specific target page
for normal logins (independent from the error handler redirect), so you
should also add a `redirectMode` like `login` to your list, and set
a target page in :confval:`redirectPageLogin <typoscript-redirectpagelogin>`.
#. Testing the custom error handler
Clear the caches, for example via the backend module
:guilabel:`System > Maintenance`.
Then open any access-restricted page
in an incognito browser window to be sure that
you are not logged in yet. Here we will use the example
URL :samp:`https://example.org/restricted/page`.
When everything is configured correctly and if you are not logged in
yet, then you should be redirected to your login page like
:samp:`https://example.org/login` (example page ID `656`).
After entering proper frontend user credentials, you should be redirected
back to :samp:`https://example.org/restricted/page`, the page where you
wanted to get to initially.
.. hint::
When you have multiple site configurations, be sure to access
the correct one. This means where both the login form is located,
and the custom error handler is configured for.
.. hint::
Do not copy the generated link from the address URL after you clicked
:guilabel:`View webpage` from the backend, and then just paste it into
the URL bar of the incognito window. The reason is that when
being logged in to the backend, a possibly simulated frontend user
login can affect your tests.
.. hint::
Do not get confused when the URL
:samp:`https://example.org/restricted/page` will be forwarded to a URL
like
:samp:`https://example.org/login?return_url=https%3A%2F%2Fexample.org%3A8443%2Frestricted%2Fpage&cHash=d0e92f9f9f7b3ca98a2e5e688ad22de9`
when you want to access the restricted page in the first place.
These are the `getpost` redirect parameters that are evaluated by
`EXT:felogin`. Now type in the user credentials of the already created
frontend user and you should get redirected to the desired
page :samp:`https://example.org/restricted/page`.
This example was taken from
`[FEATURE] Introduce ErrorHandler for 403 errors with redirect option <https://review.typo3.org/c/Packages/TYPO3.CMS/+/81945>`__
which works in TYPO3 v11 and v12, and has been integrated to TYPO3 v13, where it can be used
without a custom implementation.
@@ -0,0 +1,157 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace MyVendor\MySitePackage\Error\PageErrorHandler;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Controller\ErrorPageController;
use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\LinkHandling\LinkService;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Page\PageAccessFailureReasons;
/**
* An error handler that redirects to a configured page, where the login
* process is handled. Passes a configurable URL parameter (`return_url` or
* `redirect_url`) to the target page.
*/
final class RedirectLoginErrorHandler implements PageErrorHandlerInterface
{
private const int PAGE_ID_LOGIN_FORM = 656;
private readonly int $loginRedirectPid;
private readonly string $loginRedirectParameter;
private readonly Context $context;
private readonly LinkService $linkService;
private readonly ErrorPageController $errorPageController;
public function __construct(private readonly int $statusCode)
{
$configuration = [
// TODO: Replace with $siteSettings[...] or something else
'loginRedirectTarget' => 't3://page?uid=' . self::PAGE_ID_LOGIN_FORM,
'loginRedirectParameter' => 'return_url',
];
$this->context = GeneralUtility::makeInstance(Context::class);
$this->linkService = GeneralUtility::makeInstance(LinkService::class);
$this->errorPageController = GeneralUtility::makeInstance(ErrorPageController::class);
$urlParams = $this->linkService->resolve($configuration['loginRedirectTarget']);
$this->loginRedirectPid = (int)($urlParams['pageuid'] ?? 0);
$this->loginRedirectParameter = $configuration['loginRedirectParameter'];
}
public function handlePageError(
ServerRequestInterface $request,
string $message,
array $reasons = []
): ResponseInterface {
$this->checkHandlerConfiguration();
if ($this->shouldHandleRequest($reasons)) {
return $this->handleLoginRedirect($request);
}
// Show general error message with a 403 HTTP status code
return $this->getGenericAccessDeniedResponse($message);
}
private function getGenericAccessDeniedResponse(string $reason): ResponseInterface
{
$reason = $reason ? ' Reason: ' . $reason : '';
$content = $this->errorPageController->errorAction(
'Page Not Found',
sprintf('The page did not exist or was inaccessible.%s', $reason),
0,
$this->statusCode,
);
return new HtmlResponse($content, $this->statusCode);
}
private function handleLoginRedirect(ServerRequestInterface $request): ResponseInterface
{
if ($this->isLoggedIn()) {
return $this->getGenericAccessDeniedResponse(
'The requested page was not accessible with the provided credentials'
);
}
/** @var Site $site */
$site = $request->getAttribute('site');
$language = $request->getAttribute('language');
$loginUrl = $site->getRouter()->generateUri(
$this->loginRedirectPid,
[
'_language' => $language,
$this->loginRedirectParameter => (string)$request->getUri(),
]
);
return new RedirectResponse($loginUrl);
}
private function shouldHandleRequest(array $reasons): bool
{
if (!isset($reasons['code'])) {
return false;
}
$accessDeniedReasons = [
PageAccessFailureReasons::ACCESS_DENIED_PAGE_NOT_RESOLVED,
PageAccessFailureReasons::ACCESS_DENIED_SUBSECTION_NOT_RESOLVED,
];
$isAccessDenied = in_array($reasons['code'], $accessDeniedReasons, true);
return $isAccessDenied || $this->isSimulatedBackendGroup();
}
private function isLoggedIn(): bool
{
if ($this->context->getPropertyFromAspect('frontend.user', 'isLoggedIn')) {
return true;
}
return $this->isSimulatedBackendGroup();
}
private function isSimulatedBackendGroup(): bool
{
if (!$this->context->getPropertyFromAspect('backend.user', 'isLoggedIn')) {
return false;
}
// look for special "any group"
$groups = $this->context->getPropertyFromAspect('frontend.user', 'groupIds');
return $groups[1] === -2;
}
private function checkHandlerConfiguration(): void
{
if ($this->loginRedirectPid === 0) {
throw new \RuntimeException('No loginRedirectTarget configured for LoginRedirect errorhandler', 1700813537);
}
if ($this->statusCode !== 403) {
throw new \RuntimeException(sprintf('Invalid HTTP status code %d for LoginRedirect errorhandler', $this->statusCode), 1700813545);
}
}
}
+31
View File
@@ -0,0 +1,31 @@
.. include:: /Includes.rst.txt
.. _get-post-paremeters:
=======================
GET and POST parameters
=======================
The extension uses several GET and POST parameters to define or override
redirect settings.
.. _noredirect:
noredirect
----------
.. container:: table-row
Parameter
noredirect
Evaluation
GET and POST
Data type
string
Description
If set to :php:`1`, no redirect will be processed after a successful
login.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

+1
View File
@@ -0,0 +1 @@
.. You can put central messages to display on all pages here
+57
View File
@@ -0,0 +1,57 @@
.. include:: /Includes.rst.txt
====================
TYPO3 Frontend Login
====================
:Extension key:
felogin
:Package name:
typo3/cms-felogin
:Version:
|release|
:Language:
en
:Author:
TYPO3 contributors
:License:
This document is published under the
`Open Content License <https://www.openhub.net/licenses/opl>`__.
:Rendered:
|today|
----
This extension provides a template-based plugin that allows website users to log
in to the TYPO3 frontend.
----
**Table of Contents:**
.. toctree::
:maxdepth: 2
:titlesonly:
Introduction/Index
Installation/Index
UsersManual/Index
LoginMechanism/Index
Configuration/Index
GetPostParameters/Index
Events/Index
Examples/Index
KnownProblems/Index
.. Meta Menu
.. toctree::
:hidden:
Sitemap
+57
View File
@@ -0,0 +1,57 @@
.. include:: /Includes.rst.txt
.. _installation:
============
Installation
============
This extension is part of the TYPO3 Core, but not installed by default.
.. contents:: Table of contents
:local:
Installation with Composer
==========================
Check whether you are already using the extension with:
.. code-block:: bash
composer show | grep felogin
This should either give you no result or something similar to:
.. code-block:: none
typo3/cms-felogin v12.4.11
If it is not installed yet, use the ``composer require`` command to install
the extension:
.. code-block:: bash
composer require typo3/cms-felogin
The given version depends on the version of the TYPO3 Core you are using.
Installation without Composer
=============================
In an installation without Composer, the extension is already shipped but might
not be activated yet. Activate it as follows:
#. In the backend, navigate to the :guilabel:`System > Extensions`
module.
#. Click the :guilabel:`Activate` icon for the Frontend Login extension.
.. figure:: /Images/InstallActivate.png
:class: with-border
:alt: Extension manager showing Frontend Login extension
Extension manager showing Frontend Login extension
Next steps
==========
:ref:`Configure the Frontend Login <configuration>`.
+60
View File
@@ -0,0 +1,60 @@
.. include:: /Includes.rst.txt
.. _introduction:
============
Introduction
============
.. _what-does-it-do:
What does it do?
================
The Frontend Login for Website Users (felogin) extension is a general
purpose extension for frontend logins. In addition to the actual login
box, it includes several methods for redirecting after login/logout
and includes forgot password functionality.
.. _screenshots:
Screenshots
===========
.. _general-settings:
General Settings
----------------
.. figure:: ../Images/GeneralSettings.png
:alt: General Settings
The plugin's general settings
.. _redirect-configuration:
Redirect Configuration
----------------------
.. figure:: ../Images/RedirectConfiguration.png
:alt: Redirect Configuration
Configuration of the redirection options
.. hint::
Be sure that in the overall `Access` tab under `User Group Access rights` the content
element and even the page itself is not set to `Hide at login`, otherwise the redirect
to the given page will not work.
.. _messages-tab:
Messages Tab
------------
.. figure:: ../Images/MessagesConfiguration.png
:alt: Messages Configuration
Configuration of the various messages (screenshot shows not all options)
+20
View File
@@ -0,0 +1,20 @@
.. include:: /Includes.rst.txt
.. _known-problems:
==============
Known Problems
==============
- If there is more than one felogin plugin on a page the password
recovery option can cause problems. This is a general problem with
plugins, but in this case the cause is a small hash in the forgot
password form which is stored in the frontend user session data.
With multiple instances on a page only one of the hashes is
stored and only one of the forgot password forms will work. Make sure
there is only one felogin plugin on the page where the password
recovery form is displayed.
- If usergroup access rights of the plugin are defined to
:guilabel:`Hide at login`, all felogin code (e.g. redirects, PSR-14 events)
will not be executed after a user successfully logged in.
@@ -0,0 +1,19 @@
.. include:: /Includes.rst.txt
.. _display:
==================
What is displayed?
==================
If there is no frontend user logged in, the login form will be
shown.
If there is a logged in frontend user, the logout form is shown.
If the forgot password link was used, the form to reset a password
based on username or email address will be shown.
If the password reset link was followed from an email, the form to
change the password will be shown.
+22
View File
@@ -0,0 +1,22 @@
.. include:: /Includes.rst.txt
.. _login-mechanism:
===============
Login mechanism
===============
In order to properly use the felogin plugin and its advanced
capabilities (such as redirect options) it is important to understand
the mechanism of frontend user login in TYPO3 CMS.
.. toctree::
:maxdepth: 5
:titlesonly:
:glob:
Display/Index
LoginProcess/Index
RedirectModes/Index
@@ -0,0 +1,22 @@
.. include:: /Includes.rst.txt
.. _login-process:
=================
The login process
=================
After the form is submitted the TYPO3 CMS authentication services will
validate the login credentials. After this process felogin will handle
the rest. This means that the felogin plugin must be visible for the
user who has logged in.
Felogin will then check any redirect options and generate the
appropriate content.
.. caution::
- Do not use the login status of a frontend user as authorization,
but **always** rely on user groups.
- Only use different storage folders for frontend users if this is really
necessary due to organizational reasons.
@@ -0,0 +1,103 @@
.. include:: /Includes.rst.txt
.. _redirect-modes:
==============
Redirect Modes
==============
The following redirect options are supported.
.. _defined-by-usergroup-record:
Defined by Usergroup Record
===========================
Within a Website usergroup record, you can specify a page where
usergroup members will be redirected after login.
.. _defined-by-user-record:
Defined by User Record
======================
This is identical to the redirection option for "defined by Usergroup
Record" but applies to a single website user instead of an entire user
group.
.. _after-login-ts-or-flexform:
After Login (TS or Flexform)
============================
This redirect page is set either in TypoScript
(:typoscript:`plugin.tx_felogin_login.settings.redirectPageLogin`) or in the
FlexForm of the felogin plugin.
.. _after-logout-ts-or-flexform:
After Logout (TS or Flexform)
=============================
Defines the redirect page after a user has logged out. Again, it can
be set in TypoScript or in the felogin plugin's FlexForm.
.. _after-login-error-ts-of-flexform:
After Login Error (TS of Flexform)
==================================
Defines the redirect page after a login error occurs. Can be set in
TypoScript or in the felogin plugin's FlexForm.
.. _defined-by-get-post-vars:
Defined by GET/POST Parameters
==============================
Redirect the visitor based on the GET/POST parameters :code:`redirect_url`.
If the TypoScript configuration
:typoscript:`config.typolinkLinkAccessRestrictedPages` is set, the GET/POST
parameter :code:`redirect_url` is used.
Example URL:
.. code-block:: text
https://example.org/index.php?id=12&redirect_url=https%3A%2F%2Fexample%2Eorg%2Fdestiny%2F
.. _defined-by-referrer:
Defined by Referrer
===================
The referrer page is used for the redirect. This basically means that
the user is sent back to the page he originally came from.
.. _defined-by-domain-entries:
Defined by Domain entries
=========================
Same as :guilabel:`Defined by Referrer`, except that only the domains listed in
:typoscript:`plugin.tx_felogin_login.domains` are allowed. If someone is sent to the
login page coming from a domain which is not listed, the redirect will
not happen.
By using the option :guilabel:`Use First Supported Mode from Selection` you can
define several fallback methods.
.. note::
It is only possible to use domains, which are known to TYPO3. This means,
that domains must be configured as :code:`base` in site settings for websites
in the current TYPO3 instance.
+9
View File
@@ -0,0 +1,9 @@
:template: sitemap.html
.. include:: /Includes.rst.txt
=======
Sitemap
=======
.. The sitemap.html template will insert here the page tree automatically.
+58
View File
@@ -0,0 +1,58 @@
.. include:: /Includes.rst.txt
.. _users-manual:
============
Users manual
============
The felogin extension requires no special configuration. All options
are available in the plugin's FlexForm as shown in the :ref:`screenshots`.
.. _using-plugin:
Using the plugin
================
The felogin plugin is available through the Content Wizard as :guilabel:`Login Form`:
.. figure:: ../Images/ContentElementWizard.png
:alt: The content element wizard
The Login Form plugin in the content element wizard
.. _storage-folder:
Choosing a user storage page for website users
==============================================
In order for Website Users to be able to log in, the "Frontend login" plugin
must know where the records are stored. There are two possibilities
for setting this storage folder:
The site's integrator may have set a default value for the
:confval:`User Storage Page <felogin-felogin-pid>` or using the
:ref:`settings-editor`. If you use the default
folder to store frontend users in your project there is nothing to do here.
If your project needs multiple storage folders for frontend users or
if there is no default storage folder set, see :ref:`Example: Override the
default storage page in the plugin's FlexForm <configuration-examples-flexform>`.
.. _access-restrictions:
Access restrictions on the felogin plugin
=========================================
A very common issue is, that the felogin plugin is set to Access:
:guilabel:`Hide at login`. After the core has processed the login request, the
page will be rendered without the felogin plugin. If there are redirect options
active they will **not be executed**, simply because the felogin plugin is
hidden.
Of course setting the felogin plugin to :guilabel:`Hide at login` and having
redirect options together doesn't really makes sense.
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<guides xmlns="https://www.phpdoc.org/guides" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.phpdoc.org/guides ../vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
links-are-relative="true">
<extension class="\T3Docs\Typo3DocsTheme\DependencyInjection\Typo3DocsThemeExtension"
project-home="https://extensions.typo3.org/extension/felogin/"
project-contact="https://typo3.slack.com/archives/C025BQLFA"
project-repository="https://github.com/typo3/typo3"
project-issues="https://forge.typo3.org/projects/typo3cms-core/issues"
edit-on-github-branch="main"
edit-on-github="typo3/typo3"
edit-on-github-directory="typo3/sysext/felogin/Documentation/"
typo3-core-preferred="main"
interlink-shortcode="typo3/cms-felogin"
/>
<project title="Frontend Login"
release="main (development)"
version="main (development)"
copyright="since 2008 by the TYPO3 contributors"
/>
</guides>