/** * Performs an authentication attempt * * @throws Zend_Auth_Adapter_Exception If authentication cannot * be performed * @return Zend_Auth_Result */ public function authenticate() { $stub = Zupal_People::getInstance(); $user = $stub->find_one(array('username' => array($this->get_username(), 'LIKE'))); $encrypted = Zupal_People::encrypt_password($this->get_password(), $user->identity()); if ($user && $user->is_saved() && $this->get_password() == $user->password) { // TODO: incorpoprate encryption $result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $user->toArray()); } else { $result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, NULL); } return $result; }