diff options
author | Marius Blüm <marius@lineone.io> | 2016-08-19 16:37:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-19 16:37:58 +0200 |
commit | 69ccb9ff7a15dbab387a3d5b111f9bcba3625df7 (patch) | |
tree | ecee7a53035e4a580cb79c229f59fe24988acac7 | |
parent | a9697eaf8be62c4e7b4fbfb05bf90cbdde2b6200 (diff) | |
parent | 429eb217809e93d3b6c3797faec385209d66f212 (diff) | |
download | nextcloud-server-69ccb9ff7a15dbab387a3d5b111f9bcba3625df7.tar.gz nextcloud-server-69ccb9ff7a15dbab387a3d5b111f9bcba3625df7.zip |
Merge pull request #978 from nextcloud/add-feedback-for-password-change
Add feedback for password change
-rw-r--r-- | settings/Controller/ChangePasswordController.php | 15 | ||||
-rw-r--r-- | settings/js/users/users.js | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/settings/Controller/ChangePasswordController.php b/settings/Controller/ChangePasswordController.php index 74abd8b57d3..df170b62f1a 100644 --- a/settings/Controller/ChangePasswordController.php +++ b/settings/Controller/ChangePasswordController.php @@ -21,6 +21,7 @@ */ namespace OC\Settings\Controller; +use OC\HintException; use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; @@ -233,11 +234,21 @@ class ChangePasswordController extends Controller { } } } else { - if ($targetUser->setPassword($password) === false) { + try { + if ($targetUser->setPassword($password) === false) { + return new JSONResponse([ + 'status' => 'error', + 'data' => [ + 'message' => $this->l->t('Unable to change password'), + ], + ]); + } + // password policy app throws exception + } catch(HintException $e) { return new JSONResponse([ 'status' => 'error', 'data' => [ - 'message' => $this->l->t('Unable to change password'), + 'message' => $e->getHint(), ], ]); } diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 6be7b2d9526..78118d5c5aa 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -670,7 +670,9 @@ $(document).ready(function () { OC.generateUrl('/settings/users/changepassword'), {username: uid, password: $(this).val(), recoveryPassword: recoveryPasswordVal}, function (result) { - if (result.status != 'success') { + if (result.status === 'success') { + OC.Notification.showTemporary(t('admin', 'Password successfully changed')); + } else { OC.Notification.showTemporary(t('admin', result.data.message)); } } |