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.
This commit is contained in:
Benjamin Dauvergne 2010-11-11 21:52:14 +01:00
parent a31333a907
commit aabce87d03
1 changed files with 7 additions and 2 deletions

View File

@ -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'];
}