1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
namespace Derhansen\FeChangePwd\Service; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Extension "fe_change_pwd" for TYPO3 CMS. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please read the |
9
|
|
|
* LICENSE.txt file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
13
|
|
|
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory; |
14
|
|
|
use TYPO3\CMS\Saltedpasswords\Salt\SaltFactory; |
|
|
|
|
15
|
|
|
use TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class OldPasswordsService |
19
|
|
|
*/ |
20
|
|
|
class OldPasswordService |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Returns if the given password equals the old password |
24
|
|
|
* |
25
|
|
|
* @param string $password |
26
|
|
|
* @return bool |
27
|
|
|
* @throws MissingPasswordHashServiceException |
28
|
|
|
* @throws \TYPO3\CMS\Core\Crypto\PasswordHashing\InvalidPasswordHashException |
29
|
|
|
*/ |
30
|
|
|
public function checkNewEqualsOldPassword(string $password) |
31
|
|
|
{ |
32
|
|
|
if (class_exists(PasswordHashFactory::class)) { |
33
|
|
|
$hashInstance = GeneralUtility::makeInstance(PasswordHashFactory::class)->getDefaultHashInstance('FE'); |
34
|
|
|
$equals = $hashInstance->checkPassword($password, $this->getFrontendUser()->user['password']); |
35
|
|
|
} elseif (SaltedPasswordsUtility::isUsageEnabled('FE')) { |
36
|
|
|
$saltingInstance = SaltFactory::getSaltingInstance(); |
37
|
|
|
$equals = $saltingInstance->checkPassword($password, $this->getFrontendUser()->user['password']); |
38
|
|
|
} else { |
39
|
|
|
throw new MissingPasswordHashServiceException( |
40
|
|
|
'No secure password hashing service could be initialized. Please check your TYPO3 system configuration', |
41
|
|
|
1557550040515 |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
return $equals; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Returns the frontendUserAuthentication |
50
|
|
|
* |
51
|
|
|
* @return \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication |
52
|
|
|
*/ |
53
|
|
|
protected function getFrontendUser() |
54
|
|
|
{ |
55
|
|
|
return $GLOBALS['TSFE']->fe_user; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths