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 @@ - +