Changeset 2386

Show
Ignore:
Timestamp:
03/31/2008 04:27:37 AM (8 months ago)
Author:
Geert
Message:

Some minor Auth tweaks

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/auth/libraries/Auth.php

    r2225 r2386  
    4545        /** 
    4646         * Loads Session and configuration options. 
     47         * 
     48         * @return  void 
    4749         */ 
    4850        public function __construct($config = array()) 
     
    5557 
    5658                // 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')); 
    5860 
    5961                // Save the config in the object 
     
    8789                        $status = TRUE; 
    8890 
    89                         if ( ! empty($role)) 
     91                        if ($role !== NULL) 
    9092                        { 
    9193                                // Check that the user has the given role 
     
    9496                } 
    9597 
    96                 // Not logged in 
    9798                return $status; 
    9899        } 
     
    101102         * Attempt to log in a user by using an ORM object and plain-text password. 
    102103         * 
    103          * @param   object  user model object 
    104          * @param   string  plain-text password to check against 
    105          * @param   bool    to allow auto-login, or "remember me" feature 
    106          * @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 
    107108         */ 
    108109        public function login(User_Model $user, $password, $remember = FALSE) 
     
    112113 
    113114                // 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)); 
    115116 
    116117                // If the user has the "login" role and the passwords match, perform a login 
     
    143144         * Attempt to automatically log a user in by using tokens. 
    144145         * 
    145          * @return  bool 
     146         * @return  boolean 
    146147         */ 
    147148        public function auto_login() 
     
    200201                } 
    201202 
    202                 return TRUE; 
     203                // Double check 
     204                return isset($_SESSION['auth_user']); 
    203205        } 
    204206 
     
    278280        { 
    279281                $salt = ''; 
     282 
    280283                foreach($this->config['salt_pattern'] as $i => $offset) 
    281284                {