Skip to content

Commit

Permalink
Update Customer.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaiMagal authored Aug 20, 2024
1 parent 73a17d2 commit e6ee827
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions classes/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1222,21 +1222,12 @@ public function transformToCustomer($idLang, $password = null)
* we set a random one for now.
*/
if (empty($password)) {
$pass_length = 16;
$min_pass_length = (int) Configuration::get('PS_SECURITY_PASSWORD_POLICY_MINIMUM_LENGTH');
if ($min_pass_length > 0 && $pass_length < $min_pass_length) {
$pass_length = $min_pass_length;
}

$max_pass_length = (int) Configuration::get('PS_SECURITY_PASSWORD_POLICY_MAXIMUM_LENGTH');
if ($max_pass_length > 0 && $pass_length > $max_pass_length) {
$pass_length = $max_pass_length;
$this->passwd = $crypto->hash(Tools::passwdGen(16, 'RANDOM'));

Check failure on line 1225 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.2)

Undefined variable: $crypto

Check failure on line 1225 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.4)

Undefined variable: $crypto

Check failure on line 1225 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.3)

Undefined variable: $crypto

Check failure on line 1225 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.1)

Undefined variable: $crypto

Check failure on line 1225 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.0)

Undefined variable: $crypto
} else {
if (!Validate::isAcceptablePasswordLength($password) || !Validate::isAcceptablePasswordScore($password)) {
return false;
}
$password = Tools::passwdGen($pass_length, 'RANDOM');
}

if (!Validate::isAcceptablePasswordLength($password) || !Validate::isAcceptablePasswordScore($password)) {
return false;
$this->passwd = $crypto->hash($password);

Check failure on line 1230 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.2)

Undefined variable: $crypto

Check failure on line 1230 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.4)

Undefined variable: $crypto

Check failure on line 1230 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.3)

Undefined variable: $crypto

Check failure on line 1230 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.1)

Undefined variable: $crypto

Check failure on line 1230 in classes/Customer.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.0)

Undefined variable: $crypto
}

/** @var \PrestaShop\PrestaShop\Core\Crypto\Hashing $crypto */
Expand Down

0 comments on commit e6ee827

Please sign in to comment.