48 parent::__construct();
49 $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) {
98 $information =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:saltedpasswords/locallang.xlf:ext.saltedpasswords.tasks.bulkupdate.label.additionalinformation.deactivateself') . $this->
getCanDeactivateSelf() .
'; ' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:saltedpasswords/locallang.xlf:ext.saltedpasswords.tasks.bulkupdate.label.additionalinformation.numberofrecords') . $this->
getNumberOfRecords();
109 $usersToUpdate =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetRows(
'uid, password', strtolower($mode) .
'_users',
'1 = 1',
'',
'uid ASC', $this->userRecordPointer[$mode] .
', ' . $this->numberOfRecords);
110 return $usersToUpdate;
121 $updateUsers = array();
122 foreach ($users as $user) {
127 $updateUsers[] = $user;
129 if (count($updateUsers) > 0) {
130 $this->updatePasswords($mode, $updateUsers);
141 protected function updatePasswords($mode, array $users) {
144 foreach ($users as $user) {
145 $newPassword = $saltedpasswordsInstance->getHashedPassword($user[
'password']);
151 $newPassword =
'M' . $newPassword;
154 $GLOBALS[
'TYPO3_DB']->exec_UPDATEquery(strtolower($mode) .
'_users',
'uid = ' . $user[
'uid'], array(
155 'password' => $newPassword
172 $isSaltedHash = FALSE;
173 if (strlen($password) > 2 && (\
TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($password,
'C$') || \
TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($password,
'M$'))) {
178 if (!$isSaltedHash) {
181 return $isSaltedHash;
191 return (
bool) preg_match(
'/[0-9abcdef]{32,32}/i', $password);
202 $this->userRecordPointer[$mode] += $number;
static determineSaltingHashingMethod($saltedHash, $mode=TYPO3_MODE)
setCanDeactivateSelf($canDeactivateSelf)
static getSaltingInstance($saltedHash='', $mode=TYPO3_MODE)
setNumberOfRecords($numberOfRecords)
getAdditionalInformation()
incrementUserRecordPointer($mode, $number)
convertPasswords($mode, array $users)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]