Handle user being undefined when not logged in

This commit is contained in:
Isaac Connor
2024-02-11 19:12:37 -05:00
parent 8bb368fe13
commit dc556c0f70

View File

@@ -92,12 +92,14 @@ 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' ) {
// Need to save this in session, can't use the value in User because it is hashed
$_SESSION['password'] = $_REQUEST['password'];
if ($user) {
$_SESSION['username'] = $user->Username();
if ( ZM_AUTH_RELAY == 'plain' ) {
// Need to save this in session, can't use the value in User because it is hashed
$_SESSION['password'] = $_REQUEST['password'];
}
generateAuthHash(ZM_AUTH_HASH_IPS);
}
generateAuthHash(ZM_AUTH_HASH_IPS);
session_write_close();
} else if ( isset($_COOKIE['ZMSESSID']) and !$user ) {
# Have a cookie set, try to load user by session