session-library has been updated. fixes #371

https://www.codeigniter.com/user_guide/installation/upgrade_300.html
This commit is contained in:
Claude 2016-09-01 13:36:36 +02:00
parent be6a8f00ee
commit 87004f63eb
3 changed files with 14 additions and 14 deletions

View File

@ -53,13 +53,13 @@ class Auth extends CI_Controller
function index() function index()
{ {
$this->db_session->keep_flashdata('tried_to'); $this->session->keep_flashdata('tried_to');
$this->login(); $this->login();
} }
function login($errorMsg = NULL) function login($errorMsg = NULL)
{ {
$this->db_session->keep_flashdata('tried_to'); $this->session->keep_flashdata('tried_to');
if (!$this->auth_ldap->is_authenticated()) if (!$this->auth_ldap->is_authenticated())
{ {
@ -76,9 +76,9 @@ class Auth extends CI_Controller
// Login WIN! // Login WIN!
if ($this->db_session->flashdata('tried_to')) if ($this->session->flashdata('tried_to'))
{ {
redirect($this->db_session->flashdata('tried_to')); redirect($this->session->flashdata('tried_to'));
} }
else else
{ {
@ -89,7 +89,7 @@ class Auth extends CI_Controller
{ {
// Login FAIL // Login FAIL
$this->db_session->set_flashdata('login_error', 'Incorrect username or password.'); $this->session->set_flashdata('login_error', 'Incorrect username or password.');
$this->load->view('auth/login_form'); $this->load->view('auth/login_form');
} }
} }
@ -104,10 +104,10 @@ class Auth extends CI_Controller
function logout() function logout()
{ {
if ($this->db_session->userdata('logged_in')) if ($this->session->userdata('logged_in'))
{ {
$data['name'] = $this->db_session->userdata('cn'); $data['name'] = $this->session->userdata('cn');
$data['username'] = $this->db_session->userdata('username'); $data['username'] = $this->session->userdata('username');
$data['logged_in'] = TRUE; $data['logged_in'] = TRUE;
$this->auth_ldap->logout(); $this->auth_ldap->logout();
} }

View File

@ -38,7 +38,7 @@ class Auth_Ldap {
log_message('debug', 'Auth_Ldap initialization commencing...'); log_message('debug', 'Auth_Ldap initialization commencing...');
// Load the session library // Load the session library
$this->ci->load->library('db_session'); $this->ci->load->library('session');
// Load the configuration // Load the configuration
$this->ci->load->config('auth_ldap'); $this->ci->load->config('auth_ldap');
@ -104,7 +104,7 @@ class Auth_Ldap {
'role' => $user_info['role'], 'role' => $user_info['role'],
'logged_in' => TRUE); 'logged_in' => TRUE);
$this->ci->db_session->set_userdata($customdata); $this->ci->session->set_userdata($customdata);
return TRUE; return TRUE;
} }
@ -113,7 +113,7 @@ class Auth_Ldap {
* @return bool * @return bool
*/ */
function is_authenticated() { function is_authenticated() {
if($this->ci->db_session->userdata('logged_in')) { if($this->ci->session->userdata('logged_in')) {
return TRUE; return TRUE;
} else { } else {
return FALSE; return FALSE;
@ -125,8 +125,8 @@ class Auth_Ldap {
*/ */
function logout() { function logout() {
// Just set logged_in to FALSE and then destroy everything for good measure // Just set logged_in to FALSE and then destroy everything for good measure
$this->ci->db_session->set_userdata(array('logged_in' => FALSE)); $this->ci->session->set_userdata(array('logged_in' => FALSE));
$this->ci->db_session->sess_destroy(); $this->ci->session->sess_destroy();
} }
/** /**

View File

@ -1,6 +1,6 @@
<?php $this->load->view('defaults/header'); ?> <?php $this->load->view('defaults/header'); ?>
<?php <?php
$message = $this->db_session->flashdata('login_error'); $message = $this->session->flashdata('login_error');
if ($message){ if ($message){
echo '<div class="login_error">'; echo '<div class="login_error">';
echo $message; echo $message;