diff options
-rw-r--r-- | settings/Controller/UsersController.php | 6 | ||||
-rw-r--r-- | settings/js/users/users.js | 10 | ||||
-rw-r--r-- | tests/Settings/Controller/UsersControllerTest.php | 12 |
3 files changed, 21 insertions, 7 deletions
diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 411269a4351..56944ced984 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -567,7 +567,8 @@ class UsersController extends Controller { 'data' => array( 'message' => (string)$this->l10n->t('Error while disabling user.') ) - ) + ), + Http::STATUS_FORBIDDEN ); } } @@ -624,7 +625,8 @@ class UsersController extends Controller { 'data' => array( 'message' => (string)$this->l10n->t('Error while enabling user.') ) - ) + ), + Http::STATUS_FORBIDDEN ); } } diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 2a0b0c09a92..387709cd64c 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -949,7 +949,15 @@ $(document).ready(function () { OC.dialogs.alert(result.data.message, t('settings', 'Error while changing status of {user}', {user: uid})); } } - ); + ).fail(function(result){ + var message = 'Unknown error'; + if( result.responseJSON && + result.responseJSON.data && + result.responseJSON.data.message) { + message = result.responseJSON.data.message; + } + OC.dialogs.alert(message, t('settings', 'Error while changing status of {user}', {user: uid})); + }); }); // init the quota field select box after it is shown the first time diff --git a/tests/Settings/Controller/UsersControllerTest.php b/tests/Settings/Controller/UsersControllerTest.php index b6eba294d36..1dd3b0c6979 100644 --- a/tests/Settings/Controller/UsersControllerTest.php +++ b/tests/Settings/Controller/UsersControllerTest.php @@ -2532,7 +2532,8 @@ class UsersControllerTest extends \Test\TestCase { 'data' => [ 'message' => 'Error while disabling user.', ], - ] + ], + Http::STATUS_FORBIDDEN ); $response = $this->getController(true)->disable('abc'); $this->assertEquals($expectedResponse, $response); @@ -2569,7 +2570,8 @@ class UsersControllerTest extends \Test\TestCase { 'data' => [ 'message' => 'Error while disabling user.', ], - ] + ], + Http::STATUS_FORBIDDEN ); $response = $this->getController(false)->disable('abc'); $this->assertEquals($expectedResponse, $response); @@ -2746,7 +2748,8 @@ class UsersControllerTest extends \Test\TestCase { 'data' => [ 'message' => 'Error while enabling user.', ], - ] + ], + Http::STATUS_FORBIDDEN ); $response = $this->getController(true)->enable('abc'); $this->assertEquals($expectedResponse, $response); @@ -2783,7 +2786,8 @@ class UsersControllerTest extends \Test\TestCase { 'data' => [ 'message' => 'Error while enabling user.', ], - ] + ], + Http::STATUS_FORBIDDEN ); $response = $this->getController(false)->enable('abc'); $this->assertEquals($expectedResponse, $response); |