|
@@ -169,12 +169,15 @@ class authentication {
|
|
|
// }
|
|
|
// $result["authorized"] = $authorized;
|
|
|
|
|
|
- //add user logs
|
|
|
+ //add the result to the user logs
|
|
|
user_logs::add($result);
|
|
|
|
|
|
//user is authorized - get user settings, check user cidr
|
|
|
if ($authorized) {
|
|
|
|
|
|
+ //regenerate the session on login
|
|
|
+ session_regenerate_id(true);
|
|
|
+
|
|
|
//set a session variable to indicate authorized is set to true
|
|
|
$_SESSION['authorized'] = true;
|
|
|
|
|
@@ -229,8 +232,15 @@ class authentication {
|
|
|
$_SESSION["user_uuid"] = $result["user_uuid"];
|
|
|
$_SESSION["context"] = $result['domain_name'];
|
|
|
|
|
|
- //used to validate the session
|
|
|
- $_SESSION["user_hash"] = hash('sha256', $_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT']);
|
|
|
+ //build the session server array to validate the session
|
|
|
+ global $conf;
|
|
|
+ if (!isset($conf['session.validate'])) { $conf['session.validate'][] = 'HTTP_USER_AGENT'; }
|
|
|
+ foreach($conf['session.validate'] as $name) {
|
|
|
+ $server_array[$name] = $_SERVER[$name];
|
|
|
+ }
|
|
|
+
|
|
|
+ //save the user hash to be used in validate the session
|
|
|
+ $_SESSION["user_hash"] = hash('sha256', implode($server_array));
|
|
|
|
|
|
//user session array
|
|
|
$_SESSION["user"]["domain_uuid"] = $result["domain_uuid"];
|
|
@@ -448,4 +458,4 @@ $response = $auth->validate();
|
|
|
print_r($response);
|
|
|
*/
|
|
|
|
|
|
-?>
|
|
|
+?>
|