diff --git a/Controleur/ControleurParamreinitmotpass.php b/Controleur/ControleurParamreinitmotpass.php index 365d2a7f..f335d2c4 100755 --- a/Controleur/ControleurParamreinitmotpass.php +++ b/Controleur/ControleurParamreinitmotpass.php @@ -1,5 +1,4 @@ societeuser->getcompsantepasswordactif("0"); + $expressionsactives = $this->societeuser->getcompsantepasswordactif("1"); + $societeuser = $this->societeuser->getVwSocieteuser($codeSociete); - $expressionsinactives = $this->societeuser->getcompsantepasswordactif("0"); - - $expressionsactives = $this->societeuser->getcompsantepasswordactif("1"); - - $societeuser = $this->societeuser->getVwSocieteuser($codeSociete); - - //var_dump($societeuser); - - - $this->genererVue(array('expressionsinactives' => $expressionsinactives, - 'expressionsactives' => $expressionsactives , - 'activerOtpouinon' => $this->activerOtpouinon, - 'societeuser' => $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("cfnvmdp")) { - $ancmdp = $this->requete->getParametre("ancmdp"); - $nvmdp = $this->requete->getParametre("nvmdp"); - $cfnvmdp = $this->requete->getParametre("cfnvmdp"); + $ancmdp = $this->requete->getParametre("ancmdp"); + $nvmdp = $this->requete->getParametre("nvmdp"); + $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)) { @@ -67,30 +88,58 @@ require_once 'Modele/Ouinon.php'; $this->rediriger("Parametresgeneraux"); } 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 { - $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() { - $idExpression = $this->requete->getParametreFormulaire("idExpression"); - $actif = $this->requete->getParametreFormulaire("actif"); + $idExpression = $this->requete->getParametreFormulaire("idExpression"); + $actif = $this->requete->getParametreFormulaire("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 + )); + } } \ No newline at end of file diff --git a/Js/fonctions.js b/Js/fonctions.js index 5760aba3..14f1035b 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -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() diff --git a/Vue/Paramreinitmotpass/index.php b/Vue/Paramreinitmotpass/index.php index ca626658..652f6975 100755 --- a/Vue/Paramreinitmotpass/index.php +++ b/Vue/Paramreinitmotpass/index.php @@ -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); - } - }); -}