From 0de0436ead87ebcfa161e5de817e49b510cfc1bc Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 7 Jan 2016 14:23:26 +0200
Subject: [PATCH] Pass Auth exceptions through on login so that custom error
 messages can be displayed.

---
 module/VuFind/src/VuFind/Auth/ILS.php      | 3 +++
 module/VuFind/src/VuFind/Auth/MultiILS.php | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/module/VuFind/src/VuFind/Auth/ILS.php b/module/VuFind/src/VuFind/Auth/ILS.php
index c8a69c509a2..3fc2bb1670d 100644
--- a/module/VuFind/src/VuFind/Auth/ILS.php
+++ b/module/VuFind/src/VuFind/Auth/ILS.php
@@ -113,6 +113,9 @@ class ILS extends AbstractBase
         // Connect to catalog:
         try {
             $patron = $this->getCatalog()->patronLogin($username, $password);
+        } catch (AuthException $e) {
+            // Pass Auth exceptions through
+            throw $e;
         } catch (\Exception $e) {
             throw new AuthException('authentication_error_technical');
         }
diff --git a/module/VuFind/src/VuFind/Auth/MultiILS.php b/module/VuFind/src/VuFind/Auth/MultiILS.php
index 16fd4a1a870..343d8c49ab0 100644
--- a/module/VuFind/src/VuFind/Auth/MultiILS.php
+++ b/module/VuFind/src/VuFind/Auth/MultiILS.php
@@ -71,6 +71,9 @@ class MultiILS extends ILS
         // Connect to catalog:
         try {
             $patron = $this->getCatalog()->patronLogin($username, $password);
+        } catch (AuthException $e) {
+            // Pass Auth exceptions through
+            throw $e;
         } catch (\Exception $e) {
             throw new AuthException('authentication_error_technical');
         }
-- 
GitLab