mirror of
https://github.com/YunoHost-Apps/agendav_ynh.git
synced 2024-09-03 20:36:12 +02:00
handle sso user changes
This commit is contained in:
parent
783b418c97
commit
985c655b08
2 changed files with 6 additions and 8 deletions
|
@ -23,28 +23,22 @@ class Login extends CI_Controller {
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
|
|
||||||
// No session
|
|
||||||
|
|
||||||
$this->extended_logs->message('INFO','inside login controller');
|
|
||||||
$user = $_SERVER['PHP_AUTH_USER'];
|
$user = $_SERVER['PHP_AUTH_USER'];
|
||||||
$passwd = $_SERVER['PHP_AUTH_PW'];
|
$passwd = $_SERVER['PHP_AUTH_PW'];
|
||||||
$this->extended_logs->message('INFO','user = ' . $user);
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'user' => mb_strtolower($user),
|
'user' => mb_strtolower($user),
|
||||||
'passwd' => $passwd,
|
'passwd' => $passwd,
|
||||||
'prefs' =>
|
'prefs' =>
|
||||||
$this->userpref->load_prefs($user)->getAll(),
|
$this->userpref->load_prefs($user)->getAll(),
|
||||||
);
|
);
|
||||||
$this->extended_logs->message('INFO','creating session for ' . $user);
|
|
||||||
$this->auth->new_session($data);
|
$this->auth->new_session($data);
|
||||||
|
|
||||||
// Already authenticated?
|
// Already authenticated?
|
||||||
if ($this->auth->is_authenticated()) {
|
if ($this->auth->is_authenticated()) {
|
||||||
$this->extended_logs->message('INFO','auth->is_authenticated() = TRUE, redirecting to main');
|
|
||||||
|
|
||||||
redirect('/main');
|
redirect('/main');
|
||||||
}
|
}
|
||||||
$this->extended_logs->message('INFO','not authenticated');
|
|
||||||
|
/*
|
||||||
|
|
||||||
$this->load->helper('form');
|
$this->load->helper('form');
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
@ -122,6 +116,7 @@ class Login extends CI_Controller {
|
||||||
|
|
||||||
$this->load->view('layouts/plain', $page_components);
|
$this->load->view('layouts/plain', $page_components);
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,9 @@ class Auth extends CI_Model {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function is_authenticated() {
|
function is_authenticated() {
|
||||||
|
if ($this->user !== $_SERVER['PHP_AUTH_USER']) {
|
||||||
|
redirect('/login');
|
||||||
|
}
|
||||||
return ($this->user === FALSE) ? FALSE : TRUE;
|
return ($this->user === FALSE) ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue