From 985c655b08500322331b639ed07dbe71f363dac0 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Tue, 7 Jan 2014 21:04:18 +0100 Subject: [PATCH] handle sso user changes --- sources/web/application/controllers/login.php | 11 +++-------- sources/web/application/models/auth.php | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sources/web/application/controllers/login.php b/sources/web/application/controllers/login.php index 7a8658d..2f9005b 100644 --- a/sources/web/application/controllers/login.php +++ b/sources/web/application/controllers/login.php @@ -23,28 +23,22 @@ class Login extends CI_Controller { public function index() { - // No session - - $this->extended_logs->message('INFO','inside login controller'); $user = $_SERVER['PHP_AUTH_USER']; $passwd = $_SERVER['PHP_AUTH_PW']; - $this->extended_logs->message('INFO','user = ' . $user); $data = array( 'user' => mb_strtolower($user), 'passwd' => $passwd, 'prefs' => $this->userpref->load_prefs($user)->getAll(), ); - $this->extended_logs->message('INFO','creating session for ' . $user); $this->auth->new_session($data); // Already authenticated? if ($this->auth->is_authenticated()) { - $this->extended_logs->message('INFO','auth->is_authenticated() = TRUE, redirecting to main'); - redirect('/main'); } - $this->extended_logs->message('INFO','not authenticated'); + + /* $this->load->helper('form'); $this->load->library('form_validation'); @@ -122,6 +116,7 @@ class Login extends CI_Controller { $this->load->view('layouts/plain', $page_components); + */ } } diff --git a/sources/web/application/models/auth.php b/sources/web/application/models/auth.php index b1e3ef5..47bb79c 100644 --- a/sources/web/application/models/auth.php +++ b/sources/web/application/models/auth.php @@ -58,6 +58,9 @@ class Auth extends CI_Model { /** */ function is_authenticated() { + if ($this->user !== $_SERVER['PHP_AUTH_USER']) { + redirect('/login'); + } return ($this->user === FALSE) ? FALSE : TRUE; }