[Pkg-owncloud-commits] [owncloud] 73/118: show a better error message when trying to create a user that already exists

David Prévot taffit at moszumanska.debian.org
Fri Mar 27 22:13:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 625cbc63a4fbfa46981d04f43523f3a895e3e088
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Mar 20 04:24:50 2015 +0100

    show a better error message when trying to create a user that already exists
---
 settings/controller/userscontroller.php | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php
index a20cbb4..0bae055 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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list