From 3a36b38b82ca4357c89fbd90b33e6acc50b91f7e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 8 Nov 2021 15:22:17 +0000 Subject: [PATCH] [Dashboard] Redirect to Login if user isn't logged in --- application/controllers/Dashboard.php | 13 ++++++++++++- application/controllers/User.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php index f539f572..ce8238fe 100644 --- a/application/controllers/Dashboard.php +++ b/application/controllers/Dashboard.php @@ -4,13 +4,24 @@ class Dashboard extends CI_Controller { public function index() { + + // Check our version and run any migrations $this->load->library('Migration'); $this->migration->current(); - + // Database connections $this->load->model('logbook_model'); $this->load->model('user_model'); + + // Check if users logged in + + if($this->user_model->validate_session() == 0) { + // user is not logged in + redirect('user/login'); + } + + if(!$this->user_model->authorize($this->config->item('auth_mode'))) { if($this->user_model->validate_session()) { $this->user_model->clear_session(); diff --git a/application/controllers/User.php b/application/controllers/User.php index 97059f73..7652f6c1 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -459,7 +459,7 @@ class User extends CI_Controller { if ($this->form_validation->run() == FALSE) { $data['page_title'] = "Login"; - $this->load->view('interface_assets/header', $data); + $this->load->view('interface_assets/mini_header', $data); $this->load->view('user/login'); $this->load->view('interface_assets/footer');