show a better error message when trying to create a user that already exists

This commit is contained in:
Robin Appelman 2015-03-20 04:24:50 +01:00
parent 2a8c3798a8
commit da4ad1c0a2
1 changed files with 9 additions and 0 deletions

View File

@ -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) {