diff options
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 839ac404c94..37bbdc9e1c4 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -426,7 +426,14 @@ class UsersController extends AUserData { } if ($displayName !== '') { - $this->editUser($userid, self::USER_FIELD_DISPLAYNAME, $displayName); + try { + $this->editUser($userid, self::USER_FIELD_DISPLAYNAME, $displayName); + } catch (OCSException $e) { + if ($newUser instanceof IUser) { + $newUser->delete(); + } + throw $e; + } } if ($quota !== '') { @@ -837,8 +844,10 @@ class UsersController extends AUserData { switch ($key) { case self::USER_FIELD_DISPLAYNAME: case IAccountManager::PROPERTY_DISPLAYNAME: - if (!$targetUser->setDisplayName($value)) { - throw new OCSException('Invalid displayname', 102); + try { + $targetUser->setDisplayName($value); + } catch (InvalidArgumentException $e) { + throw new OCSException($e->getMessage(), 101); } break; case self::USER_FIELD_QUOTA: |