From decb4789bbf3983713b7f4c9d7ee0e984a0b2ceb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 May 2016 10:05:26 +0200 Subject: Pass on the error message from the user manager to the UI --- settings/controller/userscontroller.php | 6 +++++- settings/js/users/users.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php index f5b7f2d2e5d..5f74eaa82fb 100644 --- a/settings/controller/userscontroller.php +++ b/settings/controller/userscontroller.php @@ -355,9 +355,13 @@ class UsersController extends Controller { try { $user = $this->userManager->createUser($username, $password); } catch (\Exception $exception) { + $message = $exception->getMessage(); + if (!$message) { + $message = $this->l10n->t('Unable to create user.'); + } return new DataResponse( array( - 'message' => (string)$this->l10n->t('Unable to create user.') + 'message' => (string) $message, ), Http::STATUS_FORBIDDEN ); diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 261d9a8eb52..02d3a25be70 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -825,7 +825,7 @@ $(document).ready(function () { }).fail(function(result) { OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', { message: result.responseJSON.message - })); + }, undefined, {escape: false})); }).success(function(){ $('#newuser').get(0).reset(); }); -- cgit v1.2.3