public function authenticate($password, $testPassword = true)
    {
        $auths = $this->loadAuthorizers($password, $testPassword);

        $lastAuthorizer = null;
        foreach ($auths as $lastAuthorizer => $result) {
            if (is_callable($result)) {
                $result = call_user_func($result);
            }

            if ($result instanceof AdapterInterface) {
                $result = $result->authenticate();
            }

            if ($result instanceof Result) {
                if (! $result->isValid()) {
                    break;
                }
            } else {
                if (true === $result) {
                    $result = new Result(Result::SUCCESS, $this->getLoginName());

                } else {
                    // Always a fail when not true
                    if ($result === false) {
                        $code   = Result::FAILURE_CREDENTIAL_INVALID;
                        $result = array();
                    } else {
                        $code   = Result::FAILURE_UNCATEGORIZED;
                        if (is_string($result)) {
                            $result = array($result);
                        }
                    }
                    $result = new Result($code, $this->getLoginName(), $result);
                    break;
                }
            }
        }

        if ($result->isValid() && $this->definition instanceof \Gems_User_DbUserDefinitionAbstract) {
            $this->definition->checkRehash($this, $password);
        }


        $this->afterAuthorization($result, $lastAuthorizer);

        // \MUtil_Echo::track($result);
        $this->_authResult = $result;

        return $result;
    }
public function authenticate($password, $testPassword = true)
    {
        $auths = $this->loadAuthorizers($password, $testPassword);

        $lastAuthorizer = null;
        foreach ($auths as $lastAuthorizer => $result) {
            if (is_callable($result)) {
                $result = call_user_func($result);
            }

            if ($result instanceof AdapterInterface) {
                $result = $result->authenticate();
            }

            if ($result instanceof Result) {
                if (! $result->isValid()) {
                    break;
                }
            } else {
                if (true === $result) {
                    $result = new Result(Result::SUCCESS, $this->getLoginName());

                } else {
                    // Always a fail when not true
                    if ($result === false) {
                        $code   = Result::FAILURE_CREDENTIAL_INVALID;
                        $result = array();
                    } else {
                        $code   = Result::FAILURE_UNCATEGORIZED;
                        if (is_string($result)) {
                            $result = array($result);
                        }
                    }
                    $result = new Result($code, $this->getLoginName(), $result);
                    break;
                }
            }
        }

        if ($result->isValid() && $this->definition instanceof \Gems_User_DbUserDefinitionAbstract) {
            $this->definition->checkRehash($this, $password);
        }


        $this->afterAuthorization($result, $lastAuthorizer);

        // \MUtil_Echo::track($result);
        $this->_authResult = $result;

        return $result;
    }
public function authenticate ( $ password , $ testPassword = true ) { $ auths = $ this -> loadAuthorizers ( $ password , $ testPassword ) ; $ lastAuthorizer = null ; foreach ( $ auths as $ lastAuthorizer => $ result ) { if ( is_callable ( $ result ) ) { $ result = call_user_func ( $ result ) ; } if ( $ result instanceof AdapterInterface ) { $ result = $ result -> authenticate ( ) ; } if ( $ result instanceof Result ) { if ( ! $ result -> isValid ( ) ) { break ; } } else { if ( true === $ result ) { $ result = new Result ( Result :: SUCCESS , $ this -> getLoginName ( ) ) ; } else { // Always a fail when not true if ( $ result === false ) { $ code = Result :: FAILURE_CREDENTIAL_INVALID ; $ result = array ( ) ; } else { $ code = Result :: FAILURE_UNCATEGORIZED ; if ( is_string ( $ result ) ) { $ result = array ( $ result ) ; } } $ result = new Result ( $ code , $ this -> getLoginName ( ) , $ result ) ; break ; } } } if ( $ result -> isValid ( ) && $ this -> definition instanceof \ Gems_User_DbUserDefinitionAbstract ) { $ this -> definition -> checkRehash ( $ this , $ password ) ; } $ this -> afterAuthorization ( $ result , $ lastAuthorizer ) ; // \MUtil_Echo::track($result); $ this -> _authResult = $ result ; return $ result ; }
Authenticate a users credentials using the submitted form

@param string $password The password to test
@param boolean $testPassword Set to false to test the non-password checks only
@return Zend\Authentication\Result
Authenticate a users credentials using the submitted form