summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-20 08:54:16 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-20 08:54:16 +0000
commit8e536c67623fb340578549ed6a4a3588797d5709 (patch)
tree19295bc5a1f5af40f121ccf9c039b1b2b7398a4c
parentb6676c32d6a4ec060489c915458f450fa0b10be5 (diff)
parentda4ad1c0a2ecedc7b5e44b458fe7e31ccc2cdb0c (diff)
downloadnextcloud-server-8e536c67623fb340578549ed6a4a3588797d5709.tar.gz
nextcloud-server-8e536c67623fb340578549ed6a4a3588797d5709.zip
Merge pull request #15050 from owncloud/user-create-exists
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) {