specific exception when no login info found in session

This commit is contained in:
Gilles Crettenand
2015-06-19 11:13:51 +02:00
parent 15cdf4082b
commit e68e7db123
2 changed files with 7 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ use BSR\Lib\WebService;
class NetBiblio extends WebService
{
/** @var string $version version number */
public static $version = '1.1.0';
public static $version = '1.1.1';
private $login = '';
private $client = 'website';
@@ -28,7 +28,7 @@ class NetBiblio extends WebService
*/
private function CheckSession()
{
if (! isset ($_SESSION["user"]["login"])) {
if (! isset ($_SESSION["user"]["login"]) || empty($_SESSION["user"]["login"])) {
return;
}
@@ -53,6 +53,10 @@ class NetBiblio extends WebService
$this->checkSession();
if(strlen($this->login) == 0) {
throw new AuthenticationException("LoginEmpty", "No login information found in session.", AuthenticationException::LOGIN_EMPTY);
}
$user = User::find($this->login);
if (!$user) {