2 declare(strict_types = 1);
18 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
52 $validPassword =
false;
53 if ($password !==
null && $password !==
'') {
54 $installToolPassword =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'installToolPassword'];
55 $hashFactory = GeneralUtility::makeInstance(PasswordHashFactory::class);
57 $hashInstance = $hashFactory->get($installToolPassword,
'BE');
58 $validPassword = $hashInstance->checkPassword($password, $installToolPassword);
61 if (md5($password) === $installToolPassword) {
65 $hashInstance = $hashFactory->getDefaultHashInstance(
'BE');
66 $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
67 $configurationManager->setLocalConfigurationValueByPath(
68 'BE/installToolPassword',
69 $hashInstance->getHashedPassword($password)
71 $validPassword =
true;
77 throw $invalidPasswordHashException;
82 $this->sessionService->setAuthorized();
95 $warningEmailAddress =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'warning_email_addr'];
96 if ($warningEmailAddress) {
97 $mailMessage = GeneralUtility::makeInstance(MailMessage::class);
99 ->addTo($warningEmailAddress)
100 ->setSubject(
'Install Tool Login at \'' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
'\'')
102 ->setBody(
'There has been an Install Tool login at TYPO3 site'
103 .
' \'' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
'\''
104 .
' (' . GeneralUtility::getIndpEnv(
'HTTP_HOST') .
')'
105 .
' from remote address \'' . GeneralUtility::getIndpEnv(
'REMOTE_ADDR') .
'\'')
115 $formValues = GeneralUtility::_GP(
'install');
116 $warningEmailAddress =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'warning_email_addr'];
117 if ($warningEmailAddress) {
118 $mailMessage = GeneralUtility::makeInstance(MailMessage::class);
120 ->addTo($warningEmailAddress)
121 ->setSubject(
'Install Tool Login ATTEMPT at \'' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
'\'')
123 ->setBody(
'There has been an Install Tool login attempt at TYPO3 site'
124 .
' \'' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
'\''
125 .
' (' . GeneralUtility::getIndpEnv(
'HTTP_HOST') .
')'
126 .
' The last 5 characters of the MD5 hash of the password tried was \'' . substr(md5($formValues[
'password']), -5) .
'\''
127 .
' remote address was \'' . GeneralUtility::getIndpEnv(
'REMOTE_ADDR') .
'\'')
141 return !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress'])
142 ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress']
143 :
'no-reply@example.com';
155 return !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName'])
156 ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName']
157 :
'TYPO3 CMS install tool';