Commit d9bca574 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[TASK] Initialize BackendUser options in constructor

Instead of calling / setting properties from the outside, the backend
user constructor can set options like lockIP centralized.

This way, certain implementations from third-party extensions
can just instantiate the object.

Resolves: #78660
Releases: master
Change-Id: If43ca2533968b54c842cbe01531fc6c33ee5352c
Reviewed-on: https://review.typo3.org/50596

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Tested-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent cb8928fc
......@@ -302,6 +302,12 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
parent::__construct();
$this->name = self::getCookieName();
$this->loginType = 'BE';
$this->warningEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
$this->lockIP = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'];
$this->sessionTimeout = (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'];
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
$this->dontSetCookie = true;
}
}
/**
......
......@@ -1019,12 +1019,6 @@ class Bootstrap
{
/** @var $backendUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */
$backendUser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
$backendUser->warningEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
$backendUser->lockIP = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'];
$backendUser->sessionTimeout = (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'];
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
$backendUser->dontSetCookie = true;
}
// The global must be available very early, because methods below
// might trigger code which relies on it. See: #45625
$GLOBALS['BE_USER'] = $backendUser;
......
......@@ -1175,7 +1175,6 @@ class TypoScriptFrontendController
// disable login-attempts to the backend account through this script
// New backend user object
$BE_USER = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class);
$BE_USER->lockIP = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'];
// Object is initialized
$BE_USER->start();
$BE_USER->unpack_uc();
......
Supports Markdown
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