Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 10.0
This commit is contained in:
commit
51be0fad99
@ -187,31 +187,31 @@ class modGeneratePassPerso extends ModeleGenPassword
|
|||||||
$spe = str_split($this->Spe);
|
$spe = str_split($this->Spe);
|
||||||
|
|
||||||
if (count(array_intersect($password_a, $maj)) < $this->NbMaj) {
|
if (count(array_intersect($password_a, $maj)) < $this->NbMaj) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(array_intersect($password_a, $num)) < $this->NbNum) {
|
if (count(array_intersect($password_a, $num)) < $this->NbNum) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(array_intersect($password_a, $spe)) < $this->NbSpe) {
|
if (count(array_intersect($password_a, $spe)) < $this->NbSpe) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->consecutiveInterationSameCharacter($password)) {
|
if (!$this->consecutiveInterationSameCharacter($password)) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consecutive iterations of the same character
|
* Check the consecutive iterations of the same character. Return false if the number doesn't match the maximum consecutive value allowed.
|
||||||
*
|
*
|
||||||
* @param string $password Password to check
|
* @param string $password Password to check
|
||||||
* @return int 0 if KO, >0 if OK
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function consecutiveInterationSameCharacter($password)
|
private function consecutiveInterationSameCharacter($password)
|
||||||
{
|
{
|
||||||
$last = "";
|
$last = "";
|
||||||
|
|
||||||
@ -224,14 +224,16 @@ class modGeneratePassPerso extends ModeleGenPassword
|
|||||||
if($c != $last) {
|
if($c != $last) {
|
||||||
$last = $c;
|
$last = $c;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
} else {
|
|
||||||
$count++;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($count >= $this->NbRepeat) {
|
$count++;
|
||||||
return 0;
|
if ($count > $this->NbRepeat) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user