#13591 public dashboard and visual console permisions user not logged

This commit is contained in:
Jonathan 2024-04-24 09:49:03 +02:00
parent 192285f0d5
commit b011b746c0
2 changed files with 28 additions and 1 deletions

View File

@ -411,6 +411,33 @@ class Manager implements PublicLogin
$config['public_dashboard'] = true;
$config['force_instant_logout'] = true;
return true;
} else {
$dashboards = self::getDashboards();
$dashboards = array_reduce(
$dashboards,
function ($carry, $item) {
$carry[$item['id']] = $item['name'];
return $carry;
},
[]
);
foreach ($dashboards as $key => $layout) {
$hash_compare = self::generatePublicHash($key);
if (hash_equals($hash, $hash_compare)) {
// "Log" user in.
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$_SESSION['id_usuario'] = get_parameter('id_user');
session_write_close();
$config['public_dashboard'] = true;
$config['force_instant_logout'] = true;
return true;
}
}
}
// Remove id user from config array if authentication has failed.

View File

@ -230,7 +230,7 @@ class User extends Entity implements PublicLogin
global $config;
$str = $config['dbpass'];
$str .= $config['id_user'];
$str .= ($config['id_user'] ?? get_parameter('id_user'));
$str .= $other_secret;
return hash('sha256', $str);
}