From f04797bda9c340043b17a790aae15f298fe00a15 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 16 Jul 2009 09:43:33 +0000
Subject: [PATCH] UserPass[Org]Base: Show all error codes to the user.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1589 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/core/lib/Auth/UserPassBase.php    | 13 +------------
 modules/core/lib/Auth/UserPassOrgBase.php | 13 +------------
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/modules/core/lib/Auth/UserPassBase.php b/modules/core/lib/Auth/UserPassBase.php
index 3c0d05266..d2cc4dada 100644
--- a/modules/core/lib/Auth/UserPassBase.php
+++ b/modules/core/lib/Auth/UserPassBase.php
@@ -139,18 +139,7 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source {
 			/* Attempt to log in. */
 			$attributes = $source->login($username, $password);
 		} catch (SimpleSAML_Error_Error $e) {
-			/* An error occured during login. Check if it is because of the wrong
-			 * username/password - if it is, we pass that error up to the login form,
-			 * if not, we let the generic error handler deal with it.
-			 */
-			if ($e->getErrorCode() === 'WRONGUSERPASS') {
-				return 'WRONGUSERPASS';
-			}
-
-			/* Some other error occured. Rethrow exception and let the generic error
-			 * handler deal with it.
-			 */
-			throw $e;
+			return $e->getErrorCode();
 		}
 
 		$state['Attributes'] = $attributes;
diff --git a/modules/core/lib/Auth/UserPassOrgBase.php b/modules/core/lib/Auth/UserPassOrgBase.php
index 9f1d47bff..6583d34e1 100644
--- a/modules/core/lib/Auth/UserPassOrgBase.php
+++ b/modules/core/lib/Auth/UserPassOrgBase.php
@@ -191,18 +191,7 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source {
 			/* Attempt to log in. */
 			$attributes = $source->login($username, $password, $organization);
 		} catch (SimpleSAML_Error_Error $e) {
-			/* An error occured during login. Check if it is because of the wrong
-			 * username/password - if it is, we pass that error up to the login form,
-			 * if not, we let the generic error handler deal with it.
-			 */
-			if ($e->getErrorCode() === 'WRONGUSERPASS') {
-				return 'WRONGUSERPASS';
-			}
-
-			/* Some other error occured. Rethrow exception and let the generic error
-			 * handler deal with it.
-			 */
-			throw $e;
+			return $e->getErrorCode();
 		}
 
 		$state['Attributes'] = $attributes;
-- 
GitLab