From aabce87d032dc44ef78b5ebd9b7b699f09b76f61 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 11 Nov 2010 21:52:14 +0100 Subject: [PATCH] Catch the case when the received assertion has the username of an already existing account Without this try/catch the user is gonna stay blocked with "Username already exists" error message as long as the simpleSAMLPhp session does not expire. --- start.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/start.php b/start.php index 65a78d4..31c215e 100644 --- a/start.php +++ b/start.php @@ -33,8 +33,13 @@ } if (! $user) { - register_user($elgg_user['username'], $elgg_user['password'], - $elgg_user['name'], $elgg_user['email']); + try { + if (!register_user($elgg_user['username'], $elgg_user['password'], + $elgg_user['name'], $elgg_user['email'])) + return 1; + } catch (RegistrationException $e) { + return true; + } $user = get_user_by_username($elgg_user['username']); $user->ldapDN = $elgg_user['ldapDN']; }