up
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user