diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-07 12:30:50 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-07 12:32:09 +0200 |
commit | 794d3ef949b487011805d50e851e5a07ad7776d4 (patch) | |
tree | e1bc5256c103678e054c7924006e6ce752e437c4 /apps/files_encryption/ajax | |
parent | 5fa1cbc4e5aa0c0127713859291a0b14a8b8e348 (diff) | |
download | nextcloud-server-794d3ef949b487011805d50e851e5a07ad7776d4.tar.gz nextcloud-server-794d3ef949b487011805d50e851e5a07ad7776d4.zip |
improved visual feedback if recovery key password gets changed
Diffstat (limited to 'apps/files_encryption/ajax')
-rw-r--r-- | apps/files_encryption/ajax/changeRecoveryPassword.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php index 71fbe333fe0..bf647f2c8fa 100644 --- a/apps/files_encryption/ajax/changeRecoveryPassword.php +++ b/apps/files_encryption/ajax/changeRecoveryPassword.php @@ -21,6 +21,32 @@ $return = false; $oldPassword = $_POST['oldPassword']; $newPassword = $_POST['newPassword']; +$confirmPassword = $_POST['confirmPassword']; + +//check if both passwords are the same +if (empty($_POST['oldPassword'])) { + $errorMessage = $l->t('Please provide the old recovery password'); + \OCP\JSON::error(array('data' => array('message' => $errorMessage))); + exit(); +} + +if (empty($_POST['newPassword'])) { + $errorMessage = $l->t('Please provide a new recovery password'); + \OCP\JSON::error(array('data' => array('message' => $errorMessage))); + exit(); +} + +if (empty($_POST['confirmPassword'])) { + $errorMessage = $l->t('Please repeat the new recovery password'); + \OCP\JSON::error(array('data' => array('message' => $errorMessage))); + exit(); +} + +if ($_POST['newPassword'] !== $_POST['confirmPassword']) { + $errorMessage = $l->t('Repeated recovery key password does not match the provided recovery key password'); + \OCP\JSON::error(array('data' => array('message' => $errorMessage))); + exit(); +} $view = new \OC\Files\View('/'); $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser()); |