Merge pull request #15050 from owncloud/user-create-exists
show a better error message when trying to create a user that already exists
This commit is contained in:
commit
8e536c6762
|
@ -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 {
|
try {
|
||||||
$user = $this->userManager->createUser($username, $password);
|
$user = $this->userManager->createUser($username, $password);
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
|
Loading…
Reference in New Issue