2 namespace TYPO3\CMS\Saltedpasswords\Task;
47 parent::__construct();
48 $this->userRecordPointer = array(
61 $processedAllRecords =
true;
63 foreach ($this->userRecordPointer as $mode => $pointer) {
65 if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled($mode)) {
67 $numberOfRows = count($usersToUpdate);
68 if ($numberOfRows > 0) {
69 $processedAllRecords =
false;
76 if ($processedAllRecords) {
78 $this->userRecordPointer = array(
83 if ($this->canDeactivateSelf) {
99 $information =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:saltedpasswords/Resources/Private/Language/locallang.xlf:ext.saltedpasswords.tasks.bulkupdate.label.additionalinformation.deactivateself') . $this->
getCanDeactivateSelf() .
'; ' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:saltedpasswords/Resources/Private/Language/locallang.xlf:ext.saltedpasswords.tasks.bulkupdate.label.additionalinformation.numberofrecords') . $this->
getNumberOfRecords();
111 $usersToUpdate =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetRows(
'uid, password', strtolower($mode) .
'_users',
'1 = 1',
'',
'uid ASC', $this->userRecordPointer[$mode] .
', ' . $this->numberOfRecords);
112 return $usersToUpdate;
124 $updateUsers = array();
125 foreach ($users as $user) {
130 $updateUsers[] = $user;
132 if (!empty($updateUsers)) {
133 $this->updatePasswords($mode, $updateUsers);
144 protected function updatePasswords($mode, array $users)
147 $saltedpasswordsInstance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(null, $mode);
148 foreach ($users as $user) {
149 $newPassword = $saltedpasswordsInstance->getHashedPassword($user[
'password']);
155 $newPassword =
'M' . $newPassword;
158 $GLOBALS[
'TYPO3_DB']->exec_UPDATEquery(strtolower($mode) .
'_users',
'uid = ' . $user[
'uid'], array(
159 'password' => $newPassword
177 $isSaltedHash =
false;
178 if (strlen($password) > 2 && (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($password,
'C$') || \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($password,
'M$'))) {
180 $isSaltedHash = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::determineSaltingHashingMethod(substr($password, 1));
183 if (!$isSaltedHash) {
184 $isSaltedHash = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::determineSaltingHashingMethod($password);
186 return $isSaltedHash;
197 return (
bool)preg_match(
'/[0-9abcdef]{32,32}/i', $password);
209 $this->userRecordPointer[$mode] += $number;