summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-03-20 04:24:50 +0100
committerRobin Appelman <icewind@owncloud.com>2015-03-20 04:24:50 +0100
commitda4ad1c0a2ecedc7b5e44b458fe7e31ccc2cdb0c (patch)
treeefd95517da07b9a6ca655a86a55b3cb8b85c4779
parent2a8c3798a8e43e1215c476815c3f7fa79d5ba91f (diff)
downloadnextcloud-server-da4ad1c0a2ecedc7b5e44b458fe7e31ccc2cdb0c.tar.gz
nextcloud-server-da4ad1c0a2ecedc7b5e44b458fe7e31ccc2cdb0c.zip
show a better error message when trying to create a user that already exists
-rw-r--r--settings/controller/userscontroller.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php
index 11afe514016..a6faa3c4a1d 100644
--- a/settings/controller/userscontroller.php
+++ b/settings/controller/userscontroller.php
@@ -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) {