specific exception when no login info found in session
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user