This commit is contained in:
Lizandro Guarnizo
2026-04-16 23:07:53 -05:00
parent aa12a87fbb
commit 0164c51c1a
10 changed files with 236 additions and 41 deletions
+12
View File
@@ -57,6 +57,18 @@ if ($_POST && !$loginBlocked) {
// Redirigir según el rol
$roleSlug = $adminUser['role'] ?? 'admin';
$modules = $adminUser['modules'] ?? [];
// 1. Página de inicio configurada explícitamente para el rol
if (!empty($adminUser['home_page'])) {
$safePath = filter_var($adminUser['home_page'], FILTER_SANITIZE_URL);
// Solo rutas relativas (evitar redirects abiertos)
if (str_starts_with($safePath, '/') && !str_starts_with($safePath, '//')) {
header('Location: ' . $safePath);
exit;
}
}
// 2. Reglas heredadas (compatibilidad hacia atrás)
if ($roleSlug === 'enfermero') {
header('Location: enfermero_portal.php');
} elseif (count($modules) === 1 && $modules[0] === 'lab_formularios') {