From 74bc4004daa97a206a61a23045094c3f0547ed24 Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Wed, 10 Dec 2025 15:08:38 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20dans=20fonction.js=20de?= =?UTF-8?q?=20la=20fonction=20connexion=5Fcookie()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Js/fonctions.js | 28 +++++++++++++++++++++------- Vue/Connexion/index.php | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index 3cfc8eb..2cccd04 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -16267,12 +16267,16 @@ function raffraichier_gabarit() function connexion_cookie() { - msgErreur=$("#msgErreur").val(); + var msgErreur = $("#msgErreur").val(); + var racineWeb = $("#racineWeb").val(); - donnees = 'msgErreur='+msgErreur; + // Validation des données + var donnees = { + msgErreur: msgErreur || '' + }; $.ajax({ - url: $("#racineWeb").val()+"Ajaxconnexioncookie/", + url: racineWeb + "Ajaxconnexioncookie/", type: 'POST', data: donnees, success: function(data) @@ -16281,17 +16285,27 @@ function connexion_cookie() }, error: function(errorData) { + console.error("Erreur AJAX:", errorData); }, complete: function() { - var login = document.getElementById("login").value; - if (login>" ") + // SOLUTION: Vérifier que l'élément existe avant d'accéder à .value + var loginElement = document.getElementById("login"); + var mdpElement = document.getElementById("mdp"); + + if (loginElement && loginElement.value && loginElement.value.trim() !== "") { - $("#mdp").focus(); + // Focus sur mdp si login a une valeur + if (mdpElement) { + mdpElement.focus(); + } } else { - $("#login").focus(); + // Focus sur login s'il existe + if (loginElement) { + loginElement.focus(); + } } } }); diff --git a/Vue/Connexion/index.php b/Vue/Connexion/index.php index a24e04e..4cb1fff 100755 --- a/Vue/Connexion/index.php +++ b/Vue/Connexion/index.php @@ -28,7 +28,7 @@ - +