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 8, 2024
1 parent 804e438 commit 4679f8c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions classes/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1220,11 +1220,14 @@ 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');
$pass_length = 16;
$max_pass_length = (int)Configuration::get('PS_SECURITY_PASSWORD_POLICY_MAXIMUM_LENGTH');
if ($max_pass_length > 0 && $default_pass_length > $max_pass_length) {
$pass_length = $max_pass_length;
}
$password = Tools::passwdGen($pass_length, 'RANDOM');
}

if (!Validate::isAcceptablePasswordLength($password) || !Validate::isAcceptablePasswordScore($password)) {
Expand Down

0 comments on commit 4679f8c

Please sign in to comment.