diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-03-20 04:24:50 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-03-20 12:57:09 +0100 |
commit | 625cbc63a4fbfa46981d04f43523f3a895e3e088 (patch) | |
tree | 9c5976aa460cf522449ab4c3af7495a8848ef79d /settings | |
parent | 5720211f70c6435651bf48b7c58704a5e5cb4ba2 (diff) | |
download | nextcloud-server-625cbc63a4fbfa46981d04f43523f3a895e3e088.tar.gz nextcloud-server-625cbc63a4fbfa46981d04f43523f3a895e3e088.zip |
show a better error message when trying to create a user that already exists
Diffstat (limited to 'settings')
-rw-r--r-- | settings/controller/userscontroller.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php index a20cbb4050a..0bae055a143 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) { |