diff --git a/typo3_src-4.5.29/typo3/sysext/saltedpasswords/classes/tasks/class.tx_saltedpasswords_tasks_bulkupdate.php b/typo3_src-4.5.29/typo3/sysext/saltedpasswords/classes/tasks/class.tx_saltedpasswords_tasks_bulkupdate.php index 54d7fab..270e3f4 100644 --- a/typo3_src-4.5.29/typo3/sysext/saltedpasswords/classes/tasks/class.tx_saltedpasswords_tasks_bulkupdate.php +++ b/typo3_src-4.5.29/typo3/sysext/saltedpasswords/classes/tasks/class.tx_saltedpasswords_tasks_bulkupdate.php @@ -105,6 +105,24 @@ class tx_saltedpasswords_Tasks_BulkUpdate extends tx_scheduler_Task { return(TRUE); } + /** + * Determine if the database password field length can contain Blowfish with MD5 prefix + * + * @param mixed $tableName Description. + * @access protected + * @return boolean true if long enough, false if not. + */ + protected function checkPasswordColumnLength($tableName) { + $fields = $GLOBALS['TYPO3_DB']->admin_get_fields($tableName); + if( is_array($fields['password']) && + !empty($fields['password']['Type'])) + { + //should be varchar(##). If not, cast to 0 + $fieldLength = (int) substr($fields['password']['Type'], 8, -1); + return ($fieldLength <= 60) ? false : true; + } + } + /** * Find next set of frontend or backend users to update. * @@ -112,6 +130,9 @@ class tx_saltedpasswords_Tasks_BulkUpdate extends tx_scheduler_Task { * @return array Rows with uid and password */ protected function findUsersToUpdate($mode) { + if(!$this->checkPasswordColumnLength(strtolower($mode) . '_users')){ + throw new Exception(sprintf("The password field length in table %s needs to be at least 61 characters.", strtolower($mode) . '_users')); + } $usersToUpdate = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 'uid, password', strtolower($mode) . '_users', diff --git a/typo3_src-4.5.29/typo3/sysext/saltedpasswords/locallang.xml b/typo3_src-4.5.29/typo3/sysext/saltedpasswords/locallang.xml index 2a67721..22b8ead 100644 --- a/typo3_src-4.5.29/typo3/sysext/saltedpasswords/locallang.xml +++ b/typo3_src-4.5.29/typo3/sysext/saltedpasswords/locallang.xml @@ -9,7 +9,7 @@ - +