mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-19 05:02:19 -04:00
Load use from session when it exists
This commit is contained in:
1 parent
b344701dea
commit
b84d005d8f
2 files changed
+33
-21
No files matched your search
@@ -93,6 +93,7 @@ class AppController extends Controller {
|
||||
if ( $stateful ) {
|
||||
|
||||
zm_session_start();
|
||||
|
||||
$_SESSION['remoteAddr'] = $_SERVER['REMOTE_ADDR']; // To help prevent session hijacking
|
||||
$_SESSION['username'] = $user['Username'];
|
||||
if ( ZM_AUTH_RELAY == 'plain' ) {
|
||||
@@ -100,6 +101,14 @@ class AppController extends Controller {
|
||||
$_SESSION['password'] = $_REQUEST['password'];
|
||||
}
|
||||
session_write_close();
|
||||
} else if ( $_COOKIE['ZMSESSID'] ) {
|
||||
# Have a cookie set, try to load user by session
|
||||
if ( ! is_session_started() )
|
||||
zm_session_start();
|
||||
else
|
||||
ZM\Logger::Debug(print_r($_SESSION,true));
|
||||
$user = userFromSession();
|
||||
session_write_close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,10 +151,7 @@ class AppController extends Controller {
|
||||
return;
|
||||
}
|
||||
} # end if ! login or logout
|
||||
if ($user['APIEnabled'] == 0 ) {
|
||||
throw new UnauthorizedException(__('API Disabled'));
|
||||
return;
|
||||
}
|
||||
|
||||
} # end if ZM_OPT_AUTH
|
||||
// make sure populated user object has APIs enabled
|
||||
} # end function beforeFilter()
|
||||
|
||||
Reference in new issue
Block a user