This commit is contained in:
KONE SOREL 2026-03-13 15:26:51 +00:00
parent 0f8bd57d89
commit e7036bc309
4 changed files with 168 additions and 93 deletions

View File

@ -1,5 +1,4 @@
<?php <?php
require_once 'Framework/Controleur.php'; require_once 'Framework/Controleur.php';
require_once 'Modele/Societeuser.php'; require_once 'Modele/Societeuser.php';
require_once 'Modele/Menuvueutilisateur.php'; require_once 'Modele/Menuvueutilisateur.php';
@ -22,21 +21,16 @@ require_once 'Modele/Ouinon.php';
public function index() public function index()
{ {
$codeSociete = $_SESSION['codeSociete']; $codeSociete = $_SESSION['codeSociete'];
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0");
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1");
$societeuser = $this->societeuser->getVwSocieteuser($codeSociete);
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0"); $this->genererVue(array(
'expressionsinactives' => $expressionsinactives,
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1"); 'expressionsactives' => $expressionsactives ,
'activerOtpouinon' => $this->activerOtpouinon,
$societeuser = $this->societeuser->getVwSocieteuser($codeSociete); 'societeuser' => $societeuser
//var_dump($societeuser);
$this->genererVue(array('expressionsinactives' => $expressionsinactives,
'expressionsactives' => $expressionsactives ,
'activerOtpouinon' => $this->activerOtpouinon,
'societeuser' => $societeuser
)); ));
} }
@ -48,18 +42,45 @@ require_once 'Modele/Ouinon.php';
&& $this->requete->existeParametre("nvmdp") && $this->requete->existeParametre("nvmdp")
&& $this->requete->existeParametre("cfnvmdp")) && $this->requete->existeParametre("cfnvmdp"))
{ {
$ancmdp = $this->requete->getParametre("ancmdp"); $ancmdp = $this->requete->getParametre("ancmdp");
$nvmdp = $this->requete->getParametre("nvmdp"); $nvmdp = $this->requete->getParametre("nvmdp");
$cfnvmdp = $this->requete->getParametre("cfnvmdp"); $cfnvmdp = $this->requete->getParametre("cfnvmdp");
if ($nvmdp != $cfnvmdp)
if ($nvmdp!=$cfnvmdp)
{ {
$this->genererVue(array('msgErreur' => 'Veuillez confirmer le nouveau mot de passe!'), "index"); $codeSociete = $_SESSION['codeSociete'];
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0");
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1");
$societeuser = $this->societeuser->getVwSocieteuser($codeSociete);
$msgErreur = _('Veuillez confirmer le nouveau mot de passe!');
$this->genererVue(array(
'expressionsinactives' => $expressionsinactives,
'expressionsactives' => $expressionsactives ,
'activerOtpouinon' => $this->activerOtpouinon,
'societeuser' => $societeuser,
'msgErreur' => $msgErreur),
"index"
);
} }
else if ($nvmdp==$ancmdp) else if ($nvmdp == $ancmdp)
{ {
$this->genererVue(array('msgErreur' => 'Veuillez changer le mot de passe!'), "index"); $codeSociete = $_SESSION['codeSociete'];
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0");
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1");
$societeuser = $this->societeuser->getVwSocieteuser($codeSociete);
$msgErreur = _('Veuillez changer le mot de passe!');
$this->genererVue(array(
'expressionsinactives' => $expressionsinactives,
'expressionsactives' => $expressionsactives ,
'activerOtpouinon' => $this->activerOtpouinon,
'societeuser' => $societeuser,
'msgErreur' => $msgErreur),
"index"
);
} }
else if ($this->societeuser->verifiermotpass($codeSociete, $ancmdp)) else if ($this->societeuser->verifiermotpass($codeSociete, $ancmdp))
{ {
@ -67,30 +88,58 @@ require_once 'Modele/Ouinon.php';
$this->rediriger("Parametresgeneraux"); $this->rediriger("Parametresgeneraux");
} }
else else
{ {
$this->genererVue(array('msgErreur' => 'Ancien mot de passe incorrect!'), "index"); $codeSociete = $_SESSION['codeSociete'];
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0");
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1");
$societeuser = $this->societeuser->getVwSocieteuser($codeSociete);
$msgErreur = _('Ancien mot de passe incorrect!');
$this->genererVue(array(
'expressionsinactives' => $expressionsinactives,
'expressionsactives' => $expressionsactives ,
'activerOtpouinon' => $this->activerOtpouinon,
'societeuser' => $societeuser,
'msgErreur' => $msgErreur),
"index"
);
} }
} }
else else
{ {
$this->genererVue(array('msgErreur' => 'Veuillez revoir votre saisie!'), "index"); $codeSociete = $_SESSION['codeSociete'];
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0");
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1");
$societeuser = $this->societeuser->getVwSocieteuser($codeSociete);
$msgErreur = _('Veuillez revoir votre saisie!');
$this->genererVue(array(
'expressionsinactives' => $expressionsinactives,
'expressionsactives' => $expressionsactives ,
'activerOtpouinon' => $this->activerOtpouinon,
'societeuser' => $societeuser,
'msgErreur' => $msgErreur),
"index"
);
} }
} }
public function majcomplexitepassword() public function majcomplexitepassword()
{ {
$idExpression = $this->requete->getParametreFormulaire("idExpression"); $idExpression = $this->requete->getParametreFormulaire("idExpression");
$actif = $this->requete->getParametreFormulaire("actif"); $actif = $this->requete->getParametreFormulaire("actif");
$this->societeuser->majcomplexitepassword($idExpression , $actif); $this->societeuser->majcomplexitepassword($idExpression , $actif);
$expressionsinactives = $this->societeuser->getcompsantepasswordactif("0"); $expressionsinactives = $this->societeuser->getcompsantepasswordactif("0");
$expressionsactives = $this->societeuser->getcompsantepasswordactif("1"); $expressionsactives = $this->societeuser->getcompsantepasswordactif("1");
$this->genererVueAjax(array('expressionsinactives' => $expressionsinactives, 'expressionsactives' => $expressionsactives)); $this->genererVueAjax(array(
} 'expressionsinactives' => $expressionsinactives,
'expressionsactives' => $expressionsactives
));
}
} }

View File

@ -89145,6 +89145,39 @@ function maj_authentification_otp()
} }
// FONCTION OTP
function maj_authentification_otp() {
const activerOtp = $("#activerOtp").val();
const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val();
if(activerOtp == "1"){
v_msg="Etes-vous sur de vouloir activer la double authentification?";
v_msgEng="Are you sure you want to enable two-factor authentication?";
}else{
v_msg="Etes-vous sur de vouloir désactiver la double authentification?";
v_msgEng="Are you sure you want to disable two-factor authentication?";
}
confirm_ebene(v_msg, v_msgEng)
.then((isConfirmed) => {
if (isConfirmed) {
$.ajax({
url: racineWeb + "Ajaxparametresgeneraux/majauthentification/",
type: 'POST',
data: { activerOtp: activerOtp },
success: function() {
let msg = (codeLangue === "en_US") ? "OTP Security updated" : "Sécurité OTP mise à jour";
toastr.success(msg);
},
complete: function() {
window.location.assign($("#racineWeb" ).val()+"Paramreinitmotpass/");
}
});
}
});
}
function modifier_param_filtrage_ip() function modifier_param_filtrage_ip()

View File

@ -213,22 +213,6 @@ window.addEventListener('load', function() {
} }
}); });
// 4. FONCTION OTP
function maj_authentification_otp() {
const activerOtp = $("#activerOtp").val();
const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val();
$.ajax({
url: racineWeb + "Paramreinitmotpass/maj_otp/",
type: 'POST',
data: { activerOtp: activerOtp },
success: function() {
let msg = (codeLangue === "en_US") ? "OTP Security updated" : "Sécurité OTP mise à jour";
toastr.success(msg);
}
});
}
</script> </script>
<style> <style>

View File

@ -1,47 +1,56 @@
<div class="row"> <?php
<div id="div_expression_non_actif" class="col-6" > function getSecurityIcon($libelle) {
$l = strtolower($libelle);
// Majuscules : Icône "A" classique
if (strpos($l, 'majuscule') !== false) return 'fa-font';
// Minuscules : Icône "a" (bascule sur une version plus petite ou spécifique)
if (strpos($l, 'minuscule') !== false) return 'fa-font';
// Chiffres
if (strpos($l, 'chiffre') !== false || strpos($l, 'numérique') !== false) return 'fa-hashtag';
// Caractères spéciaux
if (strpos($l, 'spécial') !== false || strpos($l, 'caractère') !== false) return 'fa-at';
// Longueur
if (strpos($l, 'longueur') !== false || strpos($l, 'caractères') !== false) return 'fa-ruler-horizontal';
return 'fa-shield-alt';
}
?>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style="font-size:10pt;"> <div id="div_complexite_pass" class="row g-3">
<thead> <div class="col-md-6" id="div_expression_non_actif">
<tr> <div class="border rounded bg-white p-3 h-100 shadow-xs">
<th style='text-align:center'> <?= _("Expressions Non Actives") ?> </th> <p class="small fw-bold text-muted text-center border-bottom pb-2 mb-3"><?= _("Expressions Non Actives") ?></p>
<th style='text-align:center'> => </th> <div class="list-group list-group-flush scroll-custom" style="max-height: 400px; overflow-y: auto;">
</tr> <?php foreach ($expressionsinactives as $exp): $icon = getSecurityIcon($exp['libelle']); ?>
</thead> <div class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 py-2">
<div class="d-flex align-items-center">
<tbody> <i class="fas <?= $icon ?> text-muted me-2" style="width: 20px; text-align: center; opacity: 0.5;"></i>
<?php foreach ($expressionsinactives as $expressionsinactive): <span class="small text-dark"><?= $this->nettoyer($exp['libelle']) ?></span>
$idExpression = $expressionsinactive['code']; </div>
?> <button class="btn btn-outline-primary btn-xs rounded-circle" onClick="ajouter_une_expression_complexite_pass('<?= $exp['code'] ?>', '1');">
<tr valign="top"> <i class="fas fa-chevron-right"></i>
<td align='center'><?= $this->nettoyer($expressionsinactive['libelle']) ?></td> </button>
<td align='center'> <input type="button" value="=>" onClick="javascript:ajouter_une_expression_complexite_pass('<?=$idExpression?>', '1');" ></td> </div>
</tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </div>
</table> </div>
</div> </div>
<div class="col-md-6" id="div_expression_actif">
<div id="div_expression_actif" class="col-6" > <div class="border rounded bg-white p-3 h-100 border-warning shadow-xs">
<p class="small fw-bold text-warning text-center border-bottom pb-2 mb-3"><?= _("Expressions Actives") ?></p>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style="font-size:10pt;"> <div class="list-group list-group-flush">
<thead> <?php foreach ($expressionsactives as $exp): $icon = getSecurityIcon($exp['libelle']); ?>
<tr> <div class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 py-2">
<th style='text-align:center'> <= </th> <button class="btn btn-outline-danger btn-xs rounded-circle" onClick="ajouter_une_expression_complexite_pass('<?= $exp['code'] ?>', '0');">
<th style='text-align:center'> <?= _("Expressions Actives") ?> </th> <i class="fas fa-chevron-left"></i>
</tr> </button>
</thead> <div class="d-flex align-items-center">
<span class="small fw-bold text-dark me-2"><?= $this->nettoyer($exp['libelle']) ?></span>
<tbody> <i class="fas <?= $icon ?> text-warning" style="width: 20px; text-align: center;"></i>
<?php foreach ($expressionsactives as $expressionsactive): </div>
$idExpression = $expressionsactive['code']; </div>
?>
<tr valign="top">
<td align='center'> <input type="button" value="<=" onClick="javascript:ajouter_une_expression_complexite_pass('<?=$idExpression?>', '0');" ></td>
<td align='center'><?= $this->nettoyer($expressionsactive['libelle']) ?></td>
</tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </div>
</table> </div>
</div> </div>
</div> </div>