diff --git a/resources/check_auth.php b/resources/check_auth.php index 459fcc9c3d..dac2f89674 100644 --- a/resources/check_auth.php +++ b/resources/check_auth.php @@ -51,7 +51,7 @@ //if session created is not set then set the time if (!isset($_SESSION['session']['created'])) { $_SESSION['session']['created'] = time(); - } + } //check the elapsed time if exceeds limit then rotate the session if (time() - $_SESSION['session']['created'] > 900) { @@ -114,11 +114,8 @@ //if the session is not authorized then verify the identity if (!$_SESSION['authorized']) { - //clear the menu - unset($_SESSION["menu"]); - //clear the template only if the template has not been assigned by the superadmin - if (empty($_SESSION['domain']['template']['name'])) { + if (empty($settings->get('domain', 'template'))) { $_SESSION["template_content"] = ''; } @@ -140,12 +137,16 @@ exit; } + //clear the menu + unset($_SESSION["menu"]); + + //get settings based on the user + $settings = new settings(['database' => $database, 'domain_uuid' => $_SESSION['domain_uuid'], 'user_uuid' => $_SESSION['user_uuid']]); + settings::clear_cache(); + //if logged in, redirect to login destination if (!isset($_REQUEST["key"])) { - //create database object - $database = database::new(); - //connect to the settings object $settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid, 'user_uuid' => $user_uuid]);