Update session handling in AJAX responses to improve user experience. Modify error messages to include session codes instead of generic messages, prompting a page reload for expired sessions. Increment version code to 4.72.794 to reflect these changes.
This commit is contained in:
@ -42,7 +42,8 @@ if ($strLangue === '') {
|
|||||||
|
|
||||||
if ($intComId <= 0) {
|
if ($intComId <= 0) {
|
||||||
$GLOBALS['__inscr_gestion_done'] = true;
|
$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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,8 @@ $vtexte_page = obtenirTextepage($vPage, $strLangue, 2);
|
|||||||
header('Content-Type: application/json; charset=utf-8');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
if (!isset($_SESSION['com_id'])) {
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,12 @@ $vtexte_page = obtenirTextepage($vPage, $strLangue, 2);
|
|||||||
$intEveId = intval($_REQUEST['eve_id'] ?? 0);
|
$intEveId = intval($_REQUEST['eve_id'] ?? 0);
|
||||||
|
|
||||||
if (empty($_SESSION['com_id'])) {
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,18 @@
|
|||||||
|
|
||||||
var cfg = window.MS1_V2_INSCR_GESTION || {};
|
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() {
|
function ms1LoaderInlineHtml() {
|
||||||
if (window.Ms1Loader) {
|
if (window.Ms1Loader) {
|
||||||
return Ms1Loader.inlineHtml(cfg.preloaderWait || undefined);
|
return Ms1Loader.inlineHtml(cfg.preloaderWait || undefined);
|
||||||
@ -73,6 +85,9 @@
|
|||||||
}, function (result) {
|
}, function (result) {
|
||||||
pendingStatutXhr = null;
|
pendingStatutXhr = null;
|
||||||
$preloader.fadeOut('slow');
|
$preloader.fadeOut('slow');
|
||||||
|
if (fxInscrRedirectIfSessionExpired(result)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (result && result.state === 'success') {
|
if (result && result.state === 'success') {
|
||||||
$select.data('prev', strCode);
|
$select.data('prev', strCode);
|
||||||
$block.addClass('inscr-gestion-statut--saved');
|
$block.addClass('inscr-gestion-statut--saved');
|
||||||
@ -166,6 +181,9 @@
|
|||||||
eve_id: $btn.data('eve_id'),
|
eve_id: $btn.data('eve_id'),
|
||||||
lang: cfg.lang || 'fr'
|
lang: cfg.lang || 'fr'
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
|
if (fxInscrRedirectIfSessionExpired(result)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (result && result.state === 'ok' && result.html) {
|
if (result && result.state === 'ok' && result.html) {
|
||||||
$panel.html(result.html);
|
$panel.html(result.html);
|
||||||
$panel.attr('data-loaded', '1');
|
$panel.attr('data-loaded', '1');
|
||||||
@ -205,6 +223,9 @@
|
|||||||
no_panier: $btn.data('no_panier'),
|
no_panier: $btn.data('no_panier'),
|
||||||
lang: cfg.lang || 'fr'
|
lang: cfg.lang || 'fr'
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
|
if (fxInscrRedirectIfSessionExpired(result)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (result && result.state === 'ok' && result.html) {
|
if (result && result.state === 'ok' && result.html) {
|
||||||
$panel.html(result.html);
|
$panel.html(result.html);
|
||||||
$panel.attr('data-loaded', '1');
|
$panel.attr('data-loaded', '1');
|
||||||
@ -387,6 +408,9 @@
|
|||||||
return response.json();
|
return response.json();
|
||||||
}).then(function (data) {
|
}).then(function (data) {
|
||||||
qrResolvePending = false;
|
qrResolvePending = false;
|
||||||
|
if (fxInscrRedirectIfSessionExpired(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!data || !data.state) {
|
if (!data || !data.state) {
|
||||||
showQrFeedback('danger', qrPanel.getAttribute('data-qr-msg-invalid') || '');
|
showQrFeedback('danger', qrPanel.getAttribute('data-qr-msg-invalid') || '');
|
||||||
window.setTimeout(function () { lastQrRaw = ''; }, 2000);
|
window.setTimeout(function () { lastQrRaw = ''; }, 2000);
|
||||||
|
|||||||
@ -16,6 +16,16 @@
|
|||||||
var strWaitMsg = cfg.preloaderWait || 'Chargement…';
|
var strWaitMsg = cfg.preloaderWait || 'Chargement…';
|
||||||
var intHubLoaderPending = 0;
|
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() {
|
function fxHubShowLoader() {
|
||||||
intHubLoaderPending++;
|
intHubLoaderPending++;
|
||||||
if (intHubLoaderPending !== 1) {
|
if (intHubLoaderPending !== 1) {
|
||||||
@ -54,6 +64,9 @@
|
|||||||
fxHubShowLoader();
|
fxHubShowLoader();
|
||||||
$.getJSON(strAjaxUrl, { a: 'event_stats', eve_id: intEve, lang: strLang })
|
$.getJSON(strAjaxUrl, { a: 'event_stats', eve_id: intEve, lang: strLang })
|
||||||
.done(function (r) {
|
.done(function (r) {
|
||||||
|
if (fxHubRedirectIfSessionExpired(r)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!r || !r.ok) {
|
if (!r || !r.ok) {
|
||||||
$collapse.find('.promoteur-hub-stats-placeholder').text(r && r.msg ? r.msg : 'Erreur');
|
$collapse.find('.promoteur-hub-stats-placeholder').text(r && r.msg ? r.msg : 'Erreur');
|
||||||
return;
|
return;
|
||||||
@ -82,6 +95,9 @@
|
|||||||
fxHubShowLoader();
|
fxHubShowLoader();
|
||||||
$.getJSON(strAjaxUrl, { a: 'event_links', eve_id: intEve, lang: strLang })
|
$.getJSON(strAjaxUrl, { a: 'event_links', eve_id: intEve, lang: strLang })
|
||||||
.done(function (r) {
|
.done(function (r) {
|
||||||
|
if (fxHubRedirectIfSessionExpired(r)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!r || !r.ok) {
|
if (!r || !r.ok) {
|
||||||
$collapse.find('.promoteur-hub-links-placeholder').text(r && r.msg ? r.msg : 'Erreur');
|
$collapse.find('.promoteur-hub-links-placeholder').text(r && r.msg ? r.msg : 'Erreur');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
* Constantes *
|
* Constantes *
|
||||||
*
|
*
|
||||||
**************/
|
**************/
|
||||||
define('_VERSION_CODE', '4.72.793');
|
define('_VERSION_CODE', '4.72.794');
|
||||||
define('_DATE_CODE', '2026-07-13');
|
define('_DATE_CODE', '2026-07-13');
|
||||||
//MSIN-4290
|
//MSIN-4290
|
||||||
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');
|
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');
|
||||||
|
|||||||
Reference in New Issue
Block a user