Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
71e922635b
@ -170,9 +170,23 @@ elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK')
|
|||||||
|
|
||||||
if ($action == 'maj_pattern')
|
if ($action == 'maj_pattern')
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", GETPOST("pattern"), 'chaine', 0, '', $conf->entity);
|
$pattern = GETPOST("pattern");
|
||||||
header("Location: security.php");
|
$explodePattern = explode(';', $pattern);
|
||||||
exit;
|
|
||||||
|
$patternInError = false;
|
||||||
|
if($explodePattern[0] < 1 || $explodePattern[4] < 0){
|
||||||
|
$patternInError = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($explodePattern[0] < $explodePattern[1] + $explodePattern[2] + $explodePattern[3]){
|
||||||
|
$patternInError = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$patternInError){
|
||||||
|
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", $pattern, 'chaine', 0, '', $conf->entity);
|
||||||
|
header("Location: security.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -278,13 +292,6 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
|
|||||||
|
|
||||||
|
|
||||||
$tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
|
$tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
|
||||||
/*$this->length2 = $tabConf[0];
|
|
||||||
$this->NbMaj = $tabConf[1];
|
|
||||||
$this->NbNum = $tabConf[2];
|
|
||||||
$this->NbSpe = $tabConf[3];
|
|
||||||
$this->NbRepeat = $tabConf[4];
|
|
||||||
$this->WithoutAmbi = $tabConf[5];
|
|
||||||
*/
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -350,6 +357,13 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
|
|||||||
print ' }';
|
print ' }';
|
||||||
|
|
||||||
print ' function valuePossible(){';
|
print ' function valuePossible(){';
|
||||||
|
print ' var fields = ["#minlenght", "#NbMajMin", "#NbNumMin", "#NbSpeMin", "#NbIteConsecutive"];';
|
||||||
|
print ' for(var i = 0 ; i < fields.length ; i++){';
|
||||||
|
print ' if($(fields[i]).val() < $(fields[i]).attr("min")){';
|
||||||
|
print ' return false;';
|
||||||
|
print ' }';
|
||||||
|
print ' }';
|
||||||
|
print ' ';
|
||||||
print ' var length = parseInt($("#minlenght").val());';
|
print ' var length = parseInt($("#minlenght").val());';
|
||||||
print ' var length_mini = parseInt($("#NbMajMin").val()) + parseInt($("#NbNumMin").val()) + parseInt($("#NbSpeMin").val());';
|
print ' var length_mini = parseInt($("#NbMajMin").val()) + parseInt($("#NbNumMin").val()) + parseInt($("#NbSpeMin").val());';
|
||||||
print ' return length >= length_mini;';
|
print ' return length >= length_mini;';
|
||||||
|
|||||||
@ -206,7 +206,7 @@ class modGeneratePassPerso extends ModeleGenPassword
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* consecutive iterations of the same character
|
* Consecutive iterations of the same character
|
||||||
*
|
*
|
||||||
* @param string $password Password to check
|
* @param string $password Password to check
|
||||||
* @return int 0 if KO, >0 if OK
|
* @return int 0 if KO, >0 if OK
|
||||||
@ -214,8 +214,12 @@ class modGeneratePassPerso extends ModeleGenPassword
|
|||||||
public function consecutiveInterationSameCharacter($password)
|
public function consecutiveInterationSameCharacter($password)
|
||||||
{
|
{
|
||||||
$last = "";
|
$last = "";
|
||||||
|
|
||||||
|
if (empty($this->NbRepeat)) return 1;
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$char = str_split($password);
|
$char = str_split($password);
|
||||||
|
|
||||||
foreach($char as $c) {
|
foreach($char as $c) {
|
||||||
if($c != $last) {
|
if($c != $last) {
|
||||||
$last = $c;
|
$last = $c;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user