diff --git a/Js/fonctions.js b/Js/fonctions.js index 4a264a6..ef29027 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -64,6 +64,8 @@ $(function() { function raffraichier_gabarit() { + controleSession(); + $.ajax({ url: $("#racineWeb").val()+"Ajaxgabarit/", success: function(data) @@ -75,13 +77,7 @@ function raffraichier_gabarit() if((codeSociete == undefined || codeSociete <= " ") && vue !="Connexion"){ - 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 s’exécute qu’après clic sur OK - window.location.assign($("#racineWeb" ).val()+"Connexion/deconnecter/"); - }); + showMessageDeconnexion(); } }, 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 s’exécute qu’après clic sur OK + window.location.assign($("#racineWeb" ).val()+"Connexion/deconnecter/"); + }); +} + /** * GESTION DU MENU BURGER * 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(() => { // Ce code ne s’exécute qu’après clic sur OK //return; + afficher_police_id(); }); }, error: function(data) { }, complete: function() { - afficher_police_id(); + } }); } @@ -3510,12 +3536,13 @@ function incorporer_assures_inmportes() alert_ebene(v_msg, v_msgEng).then(() => { // Ce code ne s’exécute qu’après clic sur OK //return; + afficher_police_id(); }); }, error: function(data) { }, complete: function() { - afficher_police_id(); + } }); } diff --git a/Vue/gabarit.php b/Vue/gabarit.php index d3bb319..68fd131 100755 --- a/Vue/gabarit.php +++ b/Vue/gabarit.php @@ -663,7 +663,7 @@ $photoAssureCrypte = $_SESSION['photoAssureCrypte']; - +