Skip to content

Commit

Permalink
Merge pull request PrestaShop#36689 from ShaiMagal/transformToCustomer
Browse files Browse the repository at this point in the history
Can't transformToCustomer while password max length is shorter than default 16 length
  • Loading branch information
Hlavtox authored Sep 19, 2024
2 parents 6612fc0 + cacaba5 commit 2c831dc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions classes/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1220,15 +1220,13 @@ public function transformToCustomer($idLang, $password = null)
/*
* If this is an anonymous conversion and we want the customer to set his own password,
* we set a random one for now.
* TODO - This should be revised in the future because 16 chars can be outside of bounds of
* isAcceptablePasswordLength. It should not be checked.
*/
if (empty($password)) {
$password = Tools::passwdGen(16, 'RANDOM');
}

if (!Validate::isAcceptablePasswordLength($password) || !Validate::isAcceptablePasswordScore($password)) {
return false;
} else {
if (!Validate::isAcceptablePasswordLength($password) || !Validate::isAcceptablePasswordScore($password)) {
return false;
}
}

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

0 comments on commit 2c831dc

Please sign in to comment.