feat (gestion exception) #19: modification fetchPassword
Some checks reported warnings
Cadoles/hydra-sql/pipeline/pr-develop This commit is unstable
Some checks reported warnings
Cadoles/hydra-sql/pipeline/pr-develop This commit is unstable
This commit is contained in:
@ -8,6 +8,7 @@ use App\SQLLogin\Exception\LoginElementsConfigurationException;
|
||||
use App\SQLLogin\Exception\NullDataToFetchException;
|
||||
use App\SQLLogin\SQLLoginConnect;
|
||||
use App\SQLLogin\SQLLoginRequest;
|
||||
use Exception;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -51,7 +52,7 @@ class SQLLoginService extends AbstractController
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public function fetchPassword($login): array|bool
|
||||
public function fetchPassword(string $login): array
|
||||
{
|
||||
try {
|
||||
$dbh = $this->getConnection();
|
||||
@ -71,14 +72,14 @@ class SQLLoginService extends AbstractController
|
||||
$this->loggerInterface->critical($e->getMessage());
|
||||
throw new LoginElementsConfigurationException($e->getMessage());
|
||||
}
|
||||
if ($password) {
|
||||
return [
|
||||
$password[$this->sqlLoginRequest->getPasswordColumnName()],
|
||||
isset($password[$this->sqlLoginRequest->getSaltColumnName()]) ? $password[$this->sqlLoginRequest->getSaltColumnName()] : null,
|
||||
];
|
||||
if (!$password) {
|
||||
throw new Exception('Une erreur est survenue lors de la récupération des données');
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
return [
|
||||
$password[$this->sqlLoginRequest->getPasswordColumnName()],
|
||||
isset($password[$this->sqlLoginRequest->getSaltColumnName()]) ? $password[$this->sqlLoginRequest->getSaltColumnName()] : null,
|
||||
];
|
||||
}
|
||||
|
||||
public function getConnection(): PDO
|
||||
|
Reference in New Issue
Block a user