#13591 public dashboard and visual console permisions user not logged
This commit is contained in:
parent
192285f0d5
commit
b011b746c0
|
@ -411,6 +411,33 @@ class Manager implements PublicLogin
|
||||||
$config['public_dashboard'] = true;
|
$config['public_dashboard'] = true;
|
||||||
$config['force_instant_logout'] = true;
|
$config['force_instant_logout'] = true;
|
||||||
return 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.
|
// Remove id user from config array if authentication has failed.
|
||||||
|
|
|
@ -230,7 +230,7 @@ class User extends Entity implements PublicLogin
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$str = $config['dbpass'];
|
$str = $config['dbpass'];
|
||||||
$str .= $config['id_user'];
|
$str .= ($config['id_user'] ?? get_parameter('id_user'));
|
||||||
$str .= $other_secret;
|
$str .= $other_secret;
|
||||||
return hash('sha256', $str);
|
return hash('sha256', $str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue