From b2b05daf762754f7ee5b8989b813c9e230a7258c Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Fri, 26 Dec 2025 11:25:13 +0000 Subject: [PATCH] Maj --- Js/fonctions.js | 49 +++++++++++++++++++++++++++++++++++++++++ Vue/Connexion/index.php | 2 +- Vue/gabarit.php | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index 78a3f7d..9b49bb2 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1,6 +1,55 @@ /** * INITIALISATION GÉNÉRALE */ +/** + * Gère la pré-connexion via cookie (chargement du formulaire et focus intelligent). + * Récupère le login mémorisé et place le curseur dans le champ approprié. + */ + +function connexion_cookie() { + const racine = $("#racineWeb").val() || ""; + const msgErreur = $("#msgErreur").val(); + + $.ajax({ + url: racine + "Ajaxconnexioncookie/", + type: 'POST', + cache: false, + // Utilisation d'un objet pour un encodage automatique sécurisé + data: { msgErreur: msgErreur }, + success: function(data) { + // Injection du formulaire de connexion + $("#div_ajaxconnexion").html(data); + + // Initialisation des composants stylisés + if ($.isFunction($.fn.selectpicker)) { + $(".selectpicker").selectpicker('refresh'); + } + }, + error: function(xhr, status, error) { + console.error("Erreur lors du chargement des cookies de connexion:", error); + }, + complete: function() { + // Gestion intelligente du focus + const $loginField = $("#login"); + const $mdpField = $("#mdp"); + const $codeSocieteField = $("#codeSociete"); + + // Si un login est déjà présent (issu du cookie) + if ($loginField.val() && $loginField.val().trim() !== "") { + // On place le curseur sur le mot de passe + $mdpField.focus(); + } else { + // Sinon, on commence par le début (Code Société ou Login) + if ($codeSocieteField.length > 0) { + $codeSocieteField.focus(); + } else { + $loginField.focus(); + } + } + } + }); +} + $(function() { // 1. Initialisation des composants au chargement de la page appliquerDataTable(); diff --git a/Vue/Connexion/index.php b/Vue/Connexion/index.php index a24e04e..b6af70b 100755 --- a/Vue/Connexion/index.php +++ b/Vue/Connexion/index.php @@ -28,7 +28,7 @@ - + diff --git a/Vue/gabarit.php b/Vue/gabarit.php index 5e4112b..4fed07a 100755 --- a/Vue/gabarit.php +++ b/Vue/gabarit.php @@ -628,7 +628,7 @@ console.groupEnd(); - +