Commit eb752df6 authored by Andreas Beutel's avatar Andreas Beutel

Merge branch 'bugfix/add-tca-for-new-hash-field-and-remove-unused' into 'develop'

Remove unused fields and add TCA for new password hash field

See merge request !171
parents b34c203a ae361bc5
Pipeline #7433 passed with stages
in 2 minutes and 50 seconds
......@@ -511,16 +511,13 @@ class Ldap implements \Psr\Log\LoggerAwareInterface
if ($this->isSaltedPassword($user->getPassword()) === false) {
/** @var \T3o\T3oLdap\Utility\PasswordHashing $passwordHashing */
$passwordHashing = GeneralUtility::makeInstance(\T3o\T3oLdap\Utility\PasswordHashing::class);
$ldapUserArray['userPassword'][] = $passwordHashing->getPasswordHash($user->getPassword(), 'sha1');
$ldapUserArray['userPassword'][] = $passwordHashing->getPasswordHash($user->getPassword(), 'crypt_sha512');
}
// if hash fields are filled, store them into ldap user and remove them afterwards
if ($this->isSaltedPassword($user->getPassword()) && ($myProfileUser->getHashSha1() || $myProfileUser->getHashCryptSha512())) {
$ldapUserArray['userPassword'][] = $myProfileUser->getHashSha1();
$ldapUserArray['userPassword'][] = $myProfileUser->getHashCryptSha512();
$myProfileUser->setHashCrypt('');
$myProfileUser->setHashCryptSha512('');
$myProfileRepository->update($myProfileUser);
GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class)->persistAll();
......
......@@ -33,10 +33,6 @@ class PasswordHashing
$ret = false;
if (trim($clearText) !== '') {
switch ($algorithm) {
case 'sha1':
$passwordHash = sha1($clearText, true);
$ret = '{SHA}' . base64_encode($passwordHash);
break;
case 'crypt_sha512':
$characters = array_merge(
range('0', '9'),
......
......@@ -32,23 +32,9 @@ $feUsersColumns = [
'type' => 'input'
],
],
'hash_md5' => [
'hash_crypt_sha512' => [
'exclude' => 0,
'label' => 'MD5 Hash of password',
'config' => [
'type' => 'none'
],
],
'hash_sha1' => [
'exclude' => 0,
'label' => 'SHA1 Hash of password',
'config' => [
'type' => 'none'
],
],
'hash_crypt' => [
'exclude' => 0,
'label' => 'Crypt Hash of password',
'label' => 'Crypt SHA512 Hash of password',
'config' => [
'type' => 'none'
],
......@@ -56,7 +42,7 @@ $feUsersColumns = [
];
$fields = 'github, twitter, facebook, terms_version';
$passwordHashFields = 'hash_md5, hash_sha1, hash_crypt';
$passwordHashFields = 'hash_crypt_sha512';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
......
......@@ -7,7 +7,6 @@ CREATE TABLE fe_users (
facebook VARCHAR (255),
terms_version VARCHAR (255),
hash_sha1 VARCHAR(255) DEFAULT '' NOT NULL,
hash_crypt_sha512 VARCHAR(255) DEFAULT '' NOT NULL
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment