fix login sql : ajout d'un retry sur le login, suppression des options #45
|
@ -7,6 +7,7 @@ use App\Security\Hasher\PasswordEncoder;
|
||||||
use App\Service\SQLLoginService;
|
use App\Service\SQLLoginService;
|
||||||
use App\SQLLogin\Exception\DatabaseConnectionException;
|
use App\SQLLogin\Exception\DatabaseConnectionException;
|
||||||
use App\SQLLogin\Exception\DataToFetchConfigurationException;
|
use App\SQLLogin\Exception\DataToFetchConfigurationException;
|
||||||
|
use App\SQLLogin\Exception\EmptyResultException;
|
||||||
use App\SQLLogin\Exception\InvalidSQLPasswordException;
|
use App\SQLLogin\Exception\InvalidSQLPasswordException;
|
||||||
use App\SQLLogin\Exception\LoginElementsConfigurationException;
|
use App\SQLLogin\Exception\LoginElementsConfigurationException;
|
||||||
use App\SQLLogin\Exception\SecurityPatternConfigurationException;
|
use App\SQLLogin\Exception\SecurityPatternConfigurationException;
|
||||||
|
@ -83,6 +84,9 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||||
$remoteSalt = $datas[$this->sqlLoginRequest->getSaltColumnName()];
|
$remoteSalt = $datas[$this->sqlLoginRequest->getSaltColumnName()];
|
||||||
unset($datas[$this->sqlLoginRequest->getSaltColumnName()]);
|
unset($datas[$this->sqlLoginRequest->getSaltColumnName()]);
|
||||||
}
|
}
|
||||||
|
} catch (EmptyResultException $e) {
|
||||||
|
$session->set(self::ERROR_LOGIN, true);
|
||||||
|
throw new AuthenticationException();
|
||||||
} catch (DatabaseConnectionException $e) {
|
} catch (DatabaseConnectionException $e) {
|
||||||
$session->set(self::ERROR_PDO, true);
|
$session->set(self::ERROR_PDO, true);
|
||||||
throw new AuthenticationException();
|
throw new AuthenticationException();
|
||||||
|
|
|
@ -52,14 +52,14 @@ class SQLLoginService extends AbstractController
|
||||||
$datas = $query->fetch(PDO::FETCH_ASSOC);
|
$datas = $query->fetch(PDO::FETCH_ASSOC);
|
||||||
$query->closeCursor();
|
$query->closeCursor();
|
||||||
if (false === $datas) {
|
if (false === $datas) {
|
||||||
usleep(1000);
|
usleep(3000);
|
||||||
++$attempt;
|
++$attempt;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self::MAX_RETRY === $attempt) {
|
if (self::MAX_RETRY === $attempt) {
|
||||||
throw new EmptyResultException('Résultat vide après 3 tentatives');
|
throw new EmptyResultException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $datas;
|
return $datas;
|
||||||
|
|
Loading…
Reference in New Issue