public function checkFailures($username, Request $request)
    {
        $failures = $this->repository->findLockedFailuresMatching($username, $request->getClientIp());

        if (0 === count($failures)) {
            return $this;
        }

        if ($this->trials < count($failures) && $this->captcha->isSetup()) {
            $response = $this->captcha->bind($request);

            if (!$response->isValid()) {
                throw new RequireCaptchaException('Too many failures, require captcha');
            }

            foreach ($failures as $failure) {
                $failure->setLocked(false);
            }

            $this->em->flush($failures);
        }

        return $this;
    }
public function checkFailures($username, Request $request)
    {
        $failures = $this->repository->findLockedFailuresMatching($username, $request->getClientIp());

        if (0 === count($failures)) {
            return $this;
        }

        if ($this->trials < count($failures) && $this->captcha->isSetup()) {
            $response = $this->captcha->bind($request);

            if (!$response->isValid()) {
                throw new RequireCaptchaException('Too many failures, require captcha');
            }

            foreach ($failures as $failure) {
                $failure->setLocked(false);
            }

            $this->em->flush($failures);
        }

        return $this;
    }
public function checkFailures ( $ username , Request $ request ) { $ failures = $ this -> repository -> findLockedFailuresMatching ( $ username , $ request -> getClientIp ( ) ) ; if ( 0 === count ( $ failures ) ) { return $ this ; } if ( $ this -> trials < count ( $ failures ) && $ this -> captcha -> isSetup ( ) ) { $ response = $ this -> captcha -> bind ( $ request ) ; if ( ! $ response -> isValid ( ) ) { throw new RequireCaptchaException ( 'Too many failures, require captcha' ) ; } foreach ( $ failures as $ failure ) { $ failure -> setLocked ( false ) ; } $ this -> em -> flush ( $ failures ) ; } return $ this ; }
Checks a request for previous failures

@param string  $username
@param Request $request

@return FailureManager

@throws RequireCaptchaException In case a captcha unlock is required
Checks a request for previous failures