コード例 #1
0
ファイル: Auth.php プロジェクト: gatorv/gecko_fw1
 /**
  * Perform the actual login against the DB
  *
  * @param string The User to Validate
  * @param string The User password to Validate
  * @return boolean
  **/
 public function login($user, $password)
 {
     if (!$this->adapter instanceof Zend_Auth_Adapter_DbTable) {
         throw new Gecko_Auth_Exception("The Adapter is not valid or not initialized");
     }
     $auth = Zend_Auth::getInstance();
     $this->adapter->setIdentity($user);
     $this->adapter->setCredential($password);
     $result = $auth->authenticate($this->adapter);
     if ($result->isValid()) {
         $data = $this->adapter->getResultRowObject(null, $this->passwordColumn);
         $userObject = new self::$userClass(get_object_vars($data));
         $auth->getStorage()->write($userObject);
         return true;
     } else {
         return false;
     }
 }