]> source.dussan.org Git - nextcloud-server.git/commitdiff
show a better error message when trying to create a user that already exists
authorRobin Appelman <icewind@owncloud.com>
Fri, 20 Mar 2015 03:24:50 +0000 (04:24 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 20 Mar 2015 03:24:50 +0000 (04:24 +0100)
settings/controller/userscontroller.php

index 11afe5140164d118a52bac355ce6616f2d947638..a6faa3c4a1dd50f195b67df36b1a878b27560bc3 100644 (file)
@@ -286,6 +286,15 @@ class UsersController extends Controller {
                        }
                }
 
+               if ($this->userManager->userExists($username)) {
+                       return new DataResponse(
+                               array(
+                                       'message' => (string)$this->l10n->t('A user with that name already exists.')
+                               ),
+                               Http::STATUS_CONFLICT
+                       );
+               }
+
                try {
                        $user = $this->userManager->createUser($username, $password);
                } catch (\Exception $exception) {