library/Garp/Model/Db/AuthLocal.php
public function tryLogin($identity, $credential, Garp_Util_Configuration $authVars, $sessionColumns = null) {
        $theOtherModel = new $authVars['model']();
        $theOtherTable = $theOtherModel->getName();
        if (is_null($sessionColumns)) {
            $sessionColumns = Zend_Db_Select::SQL_WILDCARD;
        }
        $select = $this->select()
          ->setIntegrityCheck(false)
          ->from($this->_name, array($authVars['credentialColumn']))
          ->joinInner($theOtherTable, $this->_name.'.user_id = '.$theOtherTable.'.id', $sessionColumns)
          ->where($theOtherTable.'.'.$authVars['identityColumn'].' = ?', $identity)
          ->order($this->_name.'.id')
        ;
        $result = $this->fetchRow($select);

        // update stats if we found a match
        if (!$result) {
            throw new Garp_Auth_Adapter_Db_UserNotFoundException();
            return null;
        }
        $foundCredential = $result->{$authVars['credentialColumn']};
        $testCredential = $authVars['hashMethod']($credential.$authVars['salt']);

        if ($foundCredential != $testCredential) {
            throw new Garp_Auth_Adapter_Db_InvalidPasswordException();
        }
        $this->getObserver('Authenticatable')->updateLoginStats($result->id);
        unset($result->{$authVars['credentialColumn']});
        return $result;
    }
public function tryLogin($identity, $credential, Garp_Util_Configuration $authVars, $sessionColumns = null) {
        $theOtherModel = new $authVars['model']();
        $theOtherTable = $theOtherModel->getName();
        if (is_null($sessionColumns)) {
            $sessionColumns = Zend_Db_Select::SQL_WILDCARD;
        }
        $select = $this->select()
          ->setIntegrityCheck(false)
          ->from($this->_name, array($authVars['credentialColumn']))
          ->joinInner($theOtherTable, $this->_name.'.user_id = '.$theOtherTable.'.id', $sessionColumns)
          ->where($theOtherTable.'.'.$authVars['identityColumn'].' = ?', $identity)
          ->order($this->_name.'.id')
        ;
        $result = $this->fetchRow($select);

        // update stats if we found a match
        if (!$result) {
            throw new Garp_Auth_Adapter_Db_UserNotFoundException();
            return null;
        }
        $foundCredential = $result->{$authVars['credentialColumn']};
        $testCredential = $authVars['hashMethod']($credential.$authVars['salt']);

        if ($foundCredential != $testCredential) {
            throw new Garp_Auth_Adapter_Db_InvalidPasswordException();
        }
        $this->getObserver('Authenticatable')->updateLoginStats($result->id);
        unset($result->{$authVars['credentialColumn']});
        return $result;
    }
public function tryLogin ( $ identity , $ credential , Garp_Util_Configuration $ authVars , $ sessionColumns = null ) { $ theOtherModel = new $ authVars [ 'model' ] ( ) ; $ theOtherTable = $ theOtherModel -> getName ( ) ; if ( is_null ( $ sessionColumns ) ) { $ sessionColumns = Zend_Db_Select :: SQL_WILDCARD ; } $ select = $ this -> select ( ) -> setIntegrityCheck ( false ) -> from ( $ this -> _name , array ( $ authVars [ 'credentialColumn' ] ) ) -> joinInner ( $ theOtherTable , $ this -> _name . '.user_id = ' . $ theOtherTable . '.id' , $ sessionColumns ) -> where ( $ theOtherTable . '.' . $ authVars [ 'identityColumn' ] . ' = ?' , $ identity ) -> order ( $ this -> _name . '.id' ) ; $ result = $ this -> fetchRow ( $ select ) ; // update stats if we found a match if ( ! $ result ) { throw new Garp_Auth_Adapter_Db_UserNotFoundException ( ) ; return null ; } $ foundCredential = $ result -> { $ authVars [ 'credentialColumn' ] } ; $ testCredential = $ authVars [ 'hashMethod' ] ( $ credential . $ authVars [ 'salt' ] ) ; if ( $ foundCredential != $ testCredential ) { throw new Garp_Auth_Adapter_Db_InvalidPasswordException ( ) ; } $ this -> getObserver ( 'Authenticatable' ) -> updateLoginStats ( $ result -> id ) ; unset ( $ result -> { $ authVars [ 'credentialColumn' ] } ) ; return $ result ; }
Try to log a user in.
@param String $identity
@param String $credential
@param Garp_Util_Configuration $authVars
@param Array $sessionColumns Which columns to retrieve for storage in the session.
@return Garp_Db_Table_Row
@throws Garp_Auth_Adapter_Db_UserNotFoundException When the user is not found
@throws Garp_Auth_Adapter_Db_InvalidPasswordException When the password does not match
Try to log a user in .