Commit 3ea205b0 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction problème : plantait si aucune base de données 'default' n'était définie.

parent 18052557
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace UnicaenAuth\Authentication\Adapter; namespace UnicaenAuth\Authentication\Adapter;
use PDOException; use PDOException;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Options\ModuleOptions;
use Zend\ServiceManager\ServiceManager; use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface; use Zend\ServiceManager\ServiceManagerAwareInterface;
...@@ -37,6 +38,9 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceManagerAwa ...@@ -37,6 +38,9 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceManagerAwa
catch (PDOException $e) { catch (PDOException $e) {
return false; return false;
} }
catch (ServiceNotFoundException $e) {
return false;
}
return $result; return $result;
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace UnicaenAuth\Authentication\Storage; namespace UnicaenAuth\Authentication\Storage;
use PDOException;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use Zend\Authentication\Exception\InvalidArgumentException; use Zend\Authentication\Exception\InvalidArgumentException;
/** /**
...@@ -26,13 +28,17 @@ class Db extends \ZfcUser\Authentication\Storage\Db ...@@ -26,13 +28,17 @@ class Db extends \ZfcUser\Authentication\Storage\Db
try { try {
$identity = parent::read(); $identity = parent::read();
} }
catch (\PDOException $pdoe) { catch (PDOException $pdoe) {
// throw new \UnicaenApp\Exception( // throw new \UnicaenApp\Exception(
// "Erreur lors de la recherche de l'utilisateur $id dans la base de données : " . $pdoe->getMessage(), // "Erreur lors de la recherche de l'utilisateur $id dans la base de données : " . $pdoe->getMessage(),
// null, // null,
// $pdoe); // $pdoe);
$identity = null; $identity = null;
} }
catch (ServiceNotFoundException $e) {
$identity = null;
}
if ($identity && !is_scalar($identity)) { if ($identity && !is_scalar($identity)) {
return $identity; return $identity;
} }
...@@ -50,6 +56,9 @@ class Db extends \ZfcUser\Authentication\Storage\Db ...@@ -50,6 +56,9 @@ class Db extends \ZfcUser\Authentication\Storage\Db
// $pdoe); // $pdoe);
$identity = null; $identity = null;
} }
catch (ServiceNotFoundException $e) {
$identity = null;
}
} }
if ($identity) { if ($identity) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment