Merge pull request #7265 from yguedidi/make-retries-an-instance-property-in-authenticatorsubscriber
Make retries an instance property in AuthenticatorSubscriber
This commit is contained in:
commit
3c1a183e2d
@ -18,7 +18,7 @@ class AuthenticatorSubscriber implements SubscriberInterface, LoggerAwareInterfa
|
|||||||
// avoid loop when login failed which can just be a bad login/password
|
// avoid loop when login failed which can just be a bad login/password
|
||||||
// after 2 attempts, we skip the login
|
// after 2 attempts, we skip the login
|
||||||
public const MAX_RETRIES = 2;
|
public const MAX_RETRIES = 2;
|
||||||
private static $retries = 0;
|
private int $retries = 0;
|
||||||
|
|
||||||
/** @var SiteConfigBuilder */
|
/** @var SiteConfigBuilder */
|
||||||
private $configBuilder;
|
private $configBuilder;
|
||||||
@ -97,9 +97,9 @@ class AuthenticatorSubscriber implements SubscriberInterface, LoggerAwareInterfa
|
|||||||
$authenticator = $this->authenticatorFactory->buildFromSiteConfig($config);
|
$authenticator = $this->authenticatorFactory->buildFromSiteConfig($config);
|
||||||
$isLoginRequired = $authenticator->isLoginRequired($body);
|
$isLoginRequired = $authenticator->isLoginRequired($body);
|
||||||
|
|
||||||
$this->logger->debug('loginIfRequested> retry #' . self::$retries . ' with login ' . ($isLoginRequired ? '' : 'not ') . 'required');
|
$this->logger->debug('loginIfRequested> retry #' . $this->retries . ' with login ' . ($isLoginRequired ? '' : 'not ') . 'required');
|
||||||
|
|
||||||
if ($isLoginRequired && self::$retries < self::MAX_RETRIES) {
|
if ($isLoginRequired && $this->retries < self::MAX_RETRIES) {
|
||||||
$client = $event->getClient();
|
$client = $event->getClient();
|
||||||
|
|
||||||
$emitter = $client->getEmitter();
|
$emitter = $client->getEmitter();
|
||||||
@ -109,7 +109,7 @@ class AuthenticatorSubscriber implements SubscriberInterface, LoggerAwareInterfa
|
|||||||
|
|
||||||
$event->retry();
|
$event->retry();
|
||||||
|
|
||||||
++self::$retries;
|
++$this->retries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user