From ea0de4d487a7a97cdef57e092a98ef89e32f1881 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 24 Jun 2026 01:52:56 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20p=C3=A1gina=20de=20inicio=20coherente=20?= =?UTF-8?q?con=20cada=20rol=20al=20iniciar=20sesi=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BD: home_page asignado a roles que lo tenían NULL: - recepcionista → /erp.php?m=turnero&v=recepcion - supervisor → /lab_dashboard.php - operador_bot → /index.php - readonly → /lab_ordenes.php login.php: fallback mejorado por módulos cuando home_page no aplica (turnero → recepcion, lab_dashboard → dashboard, etc.) index.php: redirige recepcionistas y roles sin whatsapp a su página correcta si por algún motivo llegan al panel de WhatsApp. Co-Authored-By: Claude Sonnet 4.6 --- index.php | 13 ++++++++++--- login.php | 14 +++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index db3dd23..094062f 100644 --- a/index.php +++ b/index.php @@ -13,10 +13,17 @@ if (!isUserLoggedIn()) { exit('Acceso denegado. Iniciar sesión'); } -// Enfermeros no tienen acceso al panel principal +// Redirigir roles que no deben ver el panel WhatsApp if (isEnfermero()) { - header('Location: enfermero_portal.php'); - exit; + header('Location: enfermero_portal.php'); exit; +} +$_indexRole = $_SESSION['admin_user']['role'] ?? ''; +$_indexModules = $_SESSION['admin_user']['modules'] ?? []; +if ($_indexRole === 'recepcionista' || (in_array('turnero', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true))) { + header('Location: erp.php?m=turnero&v=recepcion'); exit; +} +if (in_array('lab_dashboard', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) { + header('Location: lab_dashboard.php'); exit; } // Verificar conexión a la base de datos diff --git a/login.php b/login.php index ffdfea8..2f0bd76 100644 --- a/login.php +++ b/login.php @@ -53,12 +53,16 @@ if ($_POST && !$loginBlocked) { } if ($roleSlug === 'enfermero') { header('Location: enfermero_portal.php'); - } elseif (count($modules) === 1 && $modules[0] === 'lab_formularios') { + } elseif (in_array('turnero', $modules, true)) { + header('Location: erp.php?m=turnero&v=recepcion'); + } elseif (in_array('lab_dashboard', $modules, true)) { + header('Location: lab_dashboard.php'); + } elseif (in_array('lab_formularios', $modules, true)) { header('Location: lab_formularios.php'); - } elseif (count($modules) === 2 - && in_array('lab_domicilios', $modules, true) - && in_array('lab_ordenes', $modules, true)) { - header('Location: lab_domicilios.php'); + } elseif (in_array('lab_ordenes', $modules, true)) { + header('Location: lab_ordenes.php'); + } elseif (in_array('whatsapp', $modules, true)) { + header('Location: index.php'); } else { header('Location: index.php'); }