diff --git a/ajax_inscr_gestion.php b/ajax_inscr_gestion.php index a551c85..e0f41ba 100644 --- a/ajax_inscr_gestion.php +++ b/ajax_inscr_gestion.php @@ -42,7 +42,8 @@ if ($strLangue === '') { if ($intComId <= 0) { $GLOBALS['__inscr_gestion_done'] = true; - echo json_encode(array('state' => 'error', 'message' => 'session')); + // MSIN-4401 — code session : le client recharge pour afficher le login. + echo json_encode(array('state' => 'error', 'code' => 'session', 'message' => 'session')); exit; } diff --git a/ajax_inscr_gestion_qr.php b/ajax_inscr_gestion_qr.php index 56b5ed9..c7cf6da 100644 --- a/ajax_inscr_gestion_qr.php +++ b/ajax_inscr_gestion_qr.php @@ -18,7 +18,8 @@ $vtexte_page = obtenirTextepage($vPage, $strLangue, 2); header('Content-Type: application/json; charset=utf-8'); if (!isset($_SESSION['com_id'])) { - echo json_encode(array('state' => 'error', 'message' => fxInscrGestionT('inscr_gestion_qr_invalid'))); + // MSIN-4401 — session morte : pas un faux "QR invalide". + echo json_encode(array('state' => 'error', 'code' => 'session', 'message' => 'session')); exit; } diff --git a/ajax_promoteur_hub.php b/ajax_promoteur_hub.php index 3995560..525ff2d 100644 --- a/ajax_promoteur_hub.php +++ b/ajax_promoteur_hub.php @@ -22,7 +22,12 @@ $vtexte_page = obtenirTextepage($vPage, $strLangue, 2); $intEveId = intval($_REQUEST['eve_id'] ?? 0); if (empty($_SESSION['com_id'])) { - echo json_encode(array('ok' => false, 'msg' => 'Non connecté')); + // MSIN-4401 — Le JS doit renvoyer au login, pas afficher un message mort. + echo json_encode(array( + 'ok' => false, + 'code' => 'session', + 'msg' => 'Session expirée', + )); exit; } diff --git a/js/v2/inscr-gestion.js b/js/v2/inscr-gestion.js index dae9069..ee3c187 100644 --- a/js/v2/inscr-gestion.js +++ b/js/v2/inscr-gestion.js @@ -7,6 +7,18 @@ var cfg = window.MS1_V2_INSCR_GESTION || {}; + // MSIN-4401 — Session expiree en AJAX : recharger → ecran de login (pas un message mort). + function fxInscrRedirectIfSessionExpired(result) { + if (!result) { + return false; + } + if (result.code === 'session' || result.message === 'session') { + window.location.reload(); + return true; + } + return false; + } + function ms1LoaderInlineHtml() { if (window.Ms1Loader) { return Ms1Loader.inlineHtml(cfg.preloaderWait || undefined); @@ -73,6 +85,9 @@ }, function (result) { pendingStatutXhr = null; $preloader.fadeOut('slow'); + if (fxInscrRedirectIfSessionExpired(result)) { + return; + } if (result && result.state === 'success') { $select.data('prev', strCode); $block.addClass('inscr-gestion-statut--saved'); @@ -166,6 +181,9 @@ eve_id: $btn.data('eve_id'), lang: cfg.lang || 'fr' }, function (result) { + if (fxInscrRedirectIfSessionExpired(result)) { + return; + } if (result && result.state === 'ok' && result.html) { $panel.html(result.html); $panel.attr('data-loaded', '1'); @@ -205,6 +223,9 @@ no_panier: $btn.data('no_panier'), lang: cfg.lang || 'fr' }, function (result) { + if (fxInscrRedirectIfSessionExpired(result)) { + return; + } if (result && result.state === 'ok' && result.html) { $panel.html(result.html); $panel.attr('data-loaded', '1'); @@ -387,6 +408,9 @@ return response.json(); }).then(function (data) { qrResolvePending = false; + if (fxInscrRedirectIfSessionExpired(data)) { + return; + } if (!data || !data.state) { showQrFeedback('danger', qrPanel.getAttribute('data-qr-msg-invalid') || ''); window.setTimeout(function () { lastQrRaw = ''; }, 2000); diff --git a/js/v2/promoteur-hub.js b/js/v2/promoteur-hub.js index 5c409ea..eed4e24 100644 --- a/js/v2/promoteur-hub.js +++ b/js/v2/promoteur-hub.js @@ -16,6 +16,16 @@ var strWaitMsg = cfg.preloaderWait || 'Chargement…'; var intHubLoaderPending = 0; + // MSIN-4401 — Session expiree : recharger la page → formulaire de login. + // Pas de message "Non connecte" qui laisse l'usager bloque. + function fxHubRedirectIfSessionExpired(r) { + if (r && (r.code === 'session' || r.msg === 'Non connecté' || r.msg === 'Session expirée')) { + window.location.reload(); + return true; + } + return false; + } + function fxHubShowLoader() { intHubLoaderPending++; if (intHubLoaderPending !== 1) { @@ -54,6 +64,9 @@ fxHubShowLoader(); $.getJSON(strAjaxUrl, { a: 'event_stats', eve_id: intEve, lang: strLang }) .done(function (r) { + if (fxHubRedirectIfSessionExpired(r)) { + return; + } if (!r || !r.ok) { $collapse.find('.promoteur-hub-stats-placeholder').text(r && r.msg ? r.msg : 'Erreur'); return; @@ -82,6 +95,9 @@ fxHubShowLoader(); $.getJSON(strAjaxUrl, { a: 'event_links', eve_id: intEve, lang: strLang }) .done(function (r) { + if (fxHubRedirectIfSessionExpired(r)) { + return; + } if (!r || !r.ok) { $collapse.find('.promoteur-hub-links-placeholder').text(r && r.msg ? r.msg : 'Erreur'); return; diff --git a/php/inc_settings.php b/php/inc_settings.php index 2464bc0..33b98ae 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.793'); +define('_VERSION_CODE', '4.72.794'); define('_DATE_CODE', '2026-07-13'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');