_config['hash_key']) return $str; else return parent::hash($str); } /** * Logs a user in. * * @param string username * @param string password * @param boolean enable autologin (not supported) * @return boolean */ protected function _login($user, $password, $remember) { if ( ! is_object($user)) { $username = $user; // Load the user // @todo Get the server ID $user = LDAP::factory('user')->bind($username,$password); } // @todo Implement conditional logging based on memberships to groups or other criteria. // @todo This check of user being logged in needs to be better if ($user) { /* // @todo To implement if ($remember === TRUE) { // Token data $data = array( 'user_id'=>$user->id, 'expires'=>time()+$this->_config['lifetime'], 'user_agent'=>sha1(Request::$user_agent), ); // Create a new autologin token $token = ORM::factory('user_token') ->values($data) ->create(); // Set the autologin cookie Cookie::set('authautologin', $token->token, $this->_config['lifetime']); } */ // Finish the login if (PHP_SAPI !== 'cli') $this->complete_login($user); return TRUE; } // Login failed return FALSE; } public function logout($destroy=FALSE,$logout_all=FALSE) { LDAP::factory('user')->disconnect(); if (PHP_SAPI !== 'cli') return parent::logout($destroy,$logout_all); } } ?>