From 81919700863a59a7b5270690795b404fe2375173 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 13 Jul 2026 16:55:47 -0400 Subject: [PATCH] Implement invitation handling for account switching in mobile interface. Introduce signature validation for invite links to prevent spoofing and enhance security. Update logout redirection to support both reset and invite links. Increment version code to 4.72.803 to reflect these changes. --- mobile.php | 91 ++++++++++++++++++++++++++++++ php/inc_fx_compte.php | 12 ++-- php/inc_fx_eve_acces_promoteur.php | 38 +++++++++++-- php/inc_settings.php | 2 +- 4 files changed, 133 insertions(+), 10 deletions(-) diff --git a/mobile.php b/mobile.php index 9961151..ecaa675 100644 --- a/mobile.php +++ b/mobile.php @@ -8,6 +8,7 @@ require_once('php/inc_fx_messages.php'); require_once('php/inc_fx_compte.php'); require_once('php/inc_fx_promoteur.php'); require_once('php/inc_fx_inscriptions_gestion.php'); +require_once('php/inc_fx_eve_acces_promoteur.php'); require_once('php/inc_v2_assets.php'); global $objDatabase, $vDomaine, $vPage, $vtexte_page; @@ -61,6 +62,96 @@ if (!isset($_SESSION['com_id'])) { exit; } +// MSIN-4401 — Lien d'invite destiné à un autre compte : forcer déconnexion. +$intInviteCom = intval($_GET['invite_com'] ?? 0); +$strInviteSig = (string)($_GET['invite_sig'] ?? ''); +$intEveForInvite = 0; +if (!empty($_GET['promoteur_eve_id'])) { + $intEveForInvite = fxInscrGestionParseEveId($_GET['promoteur_eve_id']); +} +if ($intInviteCom > 0 && $intEveForInvite > 0 + && function_exists('fxEveAccesPromoteurInviteSigValid') + && fxEveAccesPromoteurInviteSigValid($intInviteCom, $intEveForInvite, $strInviteSig) + && intval($_SESSION['com_id']) !== $intInviteCom) { + + global $objDatabase; + $arrInviteCompte = $objDatabase->fxGetRow( + 'SELECT com_id, com_prenom, com_nom, com_courriel, com_login FROM inscriptions_comptes WHERE com_id = ' + . $intInviteCom . ' AND com_actif = 1 LIMIT 1' + ); + + $strSessionLabel = trim( + (string)($_SESSION['com_info']['com_prenom'] ?? $_SESSION['com_prenom'] ?? '') + . ' ' + . (string)($_SESSION['com_info']['com_nom'] ?? '') + ); + if ($strSessionLabel === '') { + $strSessionLabel = (string)($_SESSION['com_info']['com_courriel'] ?? ('#' . intval($_SESSION['com_id']))); + } + $strTargetLabel = $arrInviteCompte + ? trim(($arrInviteCompte['com_prenom'] ?? '') . ' ' . ($arrInviteCompte['com_nom'] ?? '')) + : ''; + if ($strTargetLabel === '' && $arrInviteCompte) { + $strTargetLabel = (string)($arrInviteCompte['com_courriel'] ?? $arrInviteCompte['com_login'] ?? ('#' . $intInviteCom)); + } + if ($strTargetLabel === '') { + $strTargetLabel = '#' . $intInviteCom; + } + $strTargetMail = $arrInviteCompte ? (string)($arrInviteCompte['com_courriel'] ?? '') : ''; + + $strReturnPath = (string)(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?: '/mobile'); + $strQs = (string)(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY) ?: ''); + if ($strQs !== '') { + $strReturnPath .= '?' . $strQs; + } + $strLogoutUrl = $vDomaine . '/logout.php?lang=' . urlencode($strLangue) + . '&return=' . rawurlencode($strReturnPath); + $strStayUrl = $vDomaine . ($strLangue === 'en' ? '/account' : '/compte'); + + $strMetaTitle = ($strLangue === 'fr') ? 'Inscriptions mobile' : 'Mobile registrations'; + $strMetaDescription = ''; + $strMetaKeywords = ''; + $blnBoutonRetour = false; + $footer_script = false; + + require_once('inc_header.php'); + ?> +
+
+
+ +
+
+
+
' . 'Un accès vous a été accordé pour ' . htmlspecialchars($strEveNom, ENT_QUOTES, 'UTF-8') . '' . ' (kit : ' . htmlspecialchars($strKit, ENT_QUOTES, 'UTF-8') . ').

' - . 'Connectez-vous avec votre compte (' . htmlspecialchars($strLogin, ENT_QUOTES, 'UTF-8') . '), ' - . 'puis ouvrez le lien ci-dessous.'; + . 'Ouvrez le lien ci-dessous et connectez-vous avec le compte ' + . '' . htmlspecialchars($strLogin, ENT_QUOTES, 'UTF-8') . ' ' + . '(si un autre compte est déjà ouvert, vous serez invité à vous déconnecter).'; $attachment_label = 'Ouvrir l\'accès (mobile)'; } else { $subject = 'New access — ' . $strEveNom; $message = 'Hello ' . $strPrenom . ',

' . 'You were granted access to ' . htmlspecialchars($strEveNom, ENT_QUOTES, 'UTF-8') . '' . ' (kit: ' . htmlspecialchars($strKit, ENT_QUOTES, 'UTF-8') . ').

' - . 'Sign in with your account (' . htmlspecialchars($strLogin, ENT_QUOTES, 'UTF-8') . '), ' - . 'then open the link below.'; + . 'Open the link below and sign in as ' + . '' . htmlspecialchars($strLogin, ENT_QUOTES, 'UTF-8') . ' ' + . '(if another account is already open, you will be asked to sign out).'; $attachment_label = 'Open access (mobile)'; } $attachment_url = $strMobileUrl; diff --git a/php/inc_settings.php b/php/inc_settings.php index ea8b5cd..d9a63b8 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.802'); +define('_VERSION_CODE', '4.72.803'); define('_DATE_CODE', '2026-07-13'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');