This commit is contained in:
KONE SOREL 2026-01-23 16:59:06 +00:00
parent 93abca7611
commit b830caa7e1
2 changed files with 37 additions and 10 deletions

View File

@ -64,6 +64,8 @@ $(function() {
function raffraichier_gabarit() function raffraichier_gabarit()
{ {
controleSession();
$.ajax({ $.ajax({
url: $("#racineWeb").val()+"Ajaxgabarit/", url: $("#racineWeb").val()+"Ajaxgabarit/",
success: function(data) success: function(data)
@ -75,13 +77,7 @@ function raffraichier_gabarit()
if((codeSociete == undefined || codeSociete <= " ") && vue !="Connexion"){ if((codeSociete == undefined || codeSociete <= " ") && vue !="Connexion"){
const msg = "Votre session a expiré. Vous serez déconnecté."; showMessageDeconnexion();
const msgEng = "Your session has expired. You will be disconnected.";
alert_ebene(msg, msgEng).then(() => {
// Ce code ne sexécute quaprès clic sur OK
window.location.assign($("#racineWeb" ).val()+"Connexion/deconnecter/");
});
} }
}, },
error: function(errorData) error: function(errorData)
@ -97,6 +93,35 @@ function raffraichier_gabarit()
}); });
} }
function controleSession() {
// Récupérer la durée de session depuis le DOM
const dureeSession = parseInt(document.getElementById('dureeSession')?.value) || 30;
const dureeMinutes = dureeSession * 60 * 1000; // Conversion en millisecondes
// Vérifier régulièrement l'activité de l'utilisateur
//setInterval(() => {
const derniereAction = sessionStorage.getItem('derniere_action');
const maintenant = Date.now();
// Si inactivité dépassant la durée autorisée
if (derniereAction && (maintenant - derniereAction > dureeMinutes)) {
showMessageDeconnexion();
}
//}, 60000); // Vérification toutes les minutes
}
function showMessageDeconnexion()
{
const msg = "Votre session a expiré. Vous serez déconnecté.";
const msgEng = "Your session has expired. You will be disconnected.";
alert_ebene(msg, msgEng).then(() => {
// Ce code ne sexécute quaprès clic sur OK
window.location.assign($("#racineWeb" ).val()+"Connexion/deconnecter/");
});
}
/** /**
* GESTION DU MENU BURGER * GESTION DU MENU BURGER
* Gère l'affichage mobile et la fermeture lors d'un clic extérieur. * Gère l'affichage mobile et la fermeture lors d'un clic extérieur.
@ -3163,12 +3188,13 @@ function incorporer_assures_inmportes()
alert_ebene(v_msg, v_msgEng).then(() => { alert_ebene(v_msg, v_msgEng).then(() => {
// Ce code ne sexécute quaprès clic sur OK // Ce code ne sexécute quaprès clic sur OK
//return; //return;
afficher_police_id();
}); });
}, },
error: function(data) { error: function(data) {
}, },
complete: function() { complete: function() {
afficher_police_id();
} }
}); });
} }
@ -3510,12 +3536,13 @@ function incorporer_assures_inmportes()
alert_ebene(v_msg, v_msgEng).then(() => { alert_ebene(v_msg, v_msgEng).then(() => {
// Ce code ne sexécute quaprès clic sur OK // Ce code ne sexécute quaprès clic sur OK
//return; //return;
afficher_police_id();
}); });
}, },
error: function(data) { error: function(data) {
}, },
complete: function() { complete: function() {
afficher_police_id();
} }
}); });
} }

View File

@ -663,7 +663,7 @@ $photoAssureCrypte = $_SESSION['photoAssureCrypte'];
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Application Scripts --> <!-- Application Scripts -->
<script src="/Js/fonctions.js?ver=2026.01.23.01"></script> <script src="/Js/fonctions.js?ver=2026.01.23.02"></script>
<script type="text/javascript"> <script type="text/javascript">
raffraichier_gabarit(); raffraichier_gabarit();