Permalink
Browse files

Fixed login_remembered_users isset error when using CI 2.0. Many than…

…ks to harryxu!
  • Loading branch information...
1 parent 1fe0194 commit ba6d09299cd7469835ab3ad7fb1a4333de88d468 @benedmunds committed Feb 21, 2011
Showing with 27 additions and 27 deletions.
  1. +6 −5 config/ion_auth.php
  2. +1 −2 libraries/Ion_auth.php
  3. +20 −20 models/ion_auth_model.php
View
11 config/ion_auth.php
@@ -91,11 +91,12 @@
* Extend the users cookies everytime they auto-login
**/
$config['user_extend_on_login'] = false;
-/**
-* Type of email to send (HTML or text)
-* Default : html
-**/
-$config['email_type'] = 'html';
+
+ /**
+ * Type of email to send (HTML or text)
+ * Default : html
+ **/
+ $config['email_type'] = 'html';
/**
* Folder where email templates are stored.
View
3 libraries/Ion_auth.php
@@ -103,8 +103,7 @@ public function __construct()
//auto-login the user if they are remembered
if (!$this->logged_in() && get_cookie('identity') && get_cookie('remember_code'))
{
- $CI = &get_instance();
- $CI->ion_auth = $this;
+ $this->ci->ion_auth = $this;
$this->ci->ion_auth_model->login_remembered_user();
}
}
View
40 models/ion_auth_model.php
@@ -646,9 +646,9 @@ public function get_users($group=false, $limit=NULL, $offset=NULL)
}
- if (isset($this->ion_auth->_extra_where))
+ if (isset($this->ion_auth->_extra_where) && !empty($this->ion_auth->_extra_where))
{
- $this->db->where($this->ion_auth->_extra_where);
+ $this->db->where($this->ion_auth->_extra_where);
}
@@ -919,9 +919,9 @@ public function update_last_login($id)
{
$this->load->helper('date');
- if (isset($this->ion_auth->_extra_where))
+ if (isset($this->ion_auth->_extra_where) && !empty($this->ion_auth->_extra_where))
{
- $this->db->where($this->ion_auth->_extra_where);
+ $this->db->where($this->ion_auth->_extra_where);
}
$this->db->update($this->tables['users'], array('last_login' => now()), array('id' => $id));
@@ -962,9 +962,9 @@ public function login_remembered_user()
}
//get the user
- if (isset($this->ion_auth->_extra_where))
+ if (isset($this->ion_auth->_extra_where) && !empty($this->ion_auth->_extra_where))
{
- $this->db->where($this->ion_auth->_extra_where);
+ $this->db->where($this->ion_auth->_extra_where);
}
$query = $this->db->select($this->identity_column.', id, group_id')
@@ -1015,7 +1015,7 @@ private function remember_user($id)
{
if (!$id)
{
- return FALSE;
+ return FALSE;
}
$user = $this->get_user($id)->row();
@@ -1026,19 +1026,19 @@ private function remember_user($id)
if ($this->db->affected_rows() > -1)
{
- set_cookie(array(
- 'name' => 'identity',
- 'value' => $user->{$this->identity_column},
- 'expire' => $this->config->item('user_expire', 'ion_auth'),
- ));
-
- set_cookie(array(
- 'name' => 'remember_code',
- 'value' => $salt,
- 'expire' => $this->config->item('user_expire', 'ion_auth'),
- ));
-
- return TRUE;
+ set_cookie(array(
+ 'name' => 'identity',
+ 'value' => $user->{$this->identity_column},
+ 'expire' => $this->config->item('user_expire', 'ion_auth'),
+ ));
+
+ set_cookie(array(
+ 'name' => 'remember_code',
+ 'value' => $salt,
+ 'expire' => $this->config->item('user_expire', 'ion_auth'),
+ ));
+
+ return TRUE;
}
return FALSE;

0 comments on commit ba6d092

Please sign in to comment.