Changeset 2386
- Timestamp:
- 03/31/2008 04:27:37 AM (8 months ago)
- Files:
-
- 1 modified
-
trunk/modules/auth/libraries/Auth.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/auth/libraries/Auth.php
r2225 r2386 45 45 /** 46 46 * Loads Session and configuration options. 47 * 48 * @return void 47 49 */ 48 50 public function __construct($config = array()) … … 55 57 56 58 // Clean up the salt pattern and split it into an array 57 $config['salt_pattern'] = preg_split('/, ?/', Config::item('auth.salt_pattern'));59 $config['salt_pattern'] = preg_split('/,\s*/', Config::item('auth.salt_pattern')); 58 60 59 61 // Save the config in the object … … 87 89 $status = TRUE; 88 90 89 if ( ! empty($role))91 if ($role !== NULL) 90 92 { 91 93 // Check that the user has the given role … … 94 96 } 95 97 96 // Not logged in97 98 return $status; 98 99 } … … 101 102 * Attempt to log in a user by using an ORM object and plain-text password. 102 103 * 103 * @param object user model object104 * @param string plain-text password to check against105 * @param bool to allow auto-login, or "remember me" feature106 * @return bool 104 * @param object user model object 105 * @param string plain-text password to check against 106 * @param boolean to allow auto-login, or "remember me" feature 107 * @return boolean 107 108 */ 108 109 public function login(User_Model $user, $password, $remember = FALSE) … … 112 113 113 114 // Create a hashed password using the salt from the stored password 114 $password = $this->hash_password($password, $this->find_salt($user->password));115 $password = $this->hash_password($password, $this->find_salt($user->password)); 115 116 116 117 // If the user has the "login" role and the passwords match, perform a login … … 143 144 * Attempt to automatically log a user in by using tokens. 144 145 * 145 * @return bool 146 * @return boolean 146 147 */ 147 148 public function auto_login() … … 200 201 } 201 202 202 return TRUE; 203 // Double check 204 return isset($_SESSION['auth_user']); 203 205 } 204 206 … … 278 280 { 279 281 $salt = ''; 282 280 283 foreach($this->config['salt_pattern'] as $i => $offset) 281 284 {
