Пример #1
0
 /**
  * Performs an auth attempt against the database
  * @return bool
  */
 public function authenticate()
 {
     $this->_config = Zend_Registry::get('config');
     if (empty($this->_email) && empty($this->_password)) {
         $this->_code = Zend_Auth_Result::FAILURE;
         $this->_data = false;
         $this->_messages[] = $this->getMessage($this->_code);
     } else {
         // Place authentication logic here
         $authenticated = true;
         if (empty($authenticated)) {
             $this->_code = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
             $this->_data = false;
             $this->_messages[] = $this->getMessage($this->_code);
         } else {
             $this->_code = Zend_Auth_Result::SUCCESS;
             $this->_data = $authenticated;
             $allProducts = Model_Product::getAll();
             $this->_messages[] = $this->getMessage($this->_code);
         }
     }
     $this->_result = new Zend_Auth_Result($this->_code, $this->_data, $this->_messages);
     return $this->_result;
 }