Fixed login/logout issue
This commit is contained in:
parent
c0ea05faee
commit
6a4fd98a03
@ -71,17 +71,18 @@ class Router
|
||||
$sessid = $sessid[1];
|
||||
$userid = explode('=', $query_string[1]);
|
||||
$userid = $userid[1];
|
||||
$ip_address = isset($_SERVER['HTTP_X_FORWADED_FOR']) ? $_SERVER['HTTP_X_FORWADED_FOR'] : $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// Check if user login
|
||||
$session = \App\Models\ClientSession::fetch([
|
||||
'uid' => $userid,
|
||||
'ip_address' => $ip_address,
|
||||
'id' => $sessid
|
||||
]);
|
||||
if (is_array($session)) {
|
||||
$token = Token::generate($userid);
|
||||
header("X-Token: $token");
|
||||
} else {
|
||||
$ip_address = isset($_SERVER['HTTP_X_FORWADED_FOR']) ? $_SERVER['HTTP_X_FORWADED_FOR'] : $_SERVER['REMOTE_ADDR'];
|
||||
$record = \App\Models\ClientSession::fetch(['ip_address' => $ip_address]);
|
||||
$obj = 'Home';
|
||||
$obj = $this->getNamespace($obj);
|
||||
|
Loading…
Reference in New Issue
Block a user