[Pkg-owncloud-commits] [owncloud] 209/258: improved visual feedback if recovery key password gets changed
David Prévot
taffit at moszumanska.debian.org
Sat Oct 11 17:22:37 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 7ee3ad411caedfa9330b7f5d4e658731d0e7b656
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Tue Oct 7 12:30:50 2014 +0200
improved visual feedback if recovery key password gets changed
---
.../ajax/changeRecoveryPassword.php | 26 ++++++++++++++++++++++
apps/files_encryption/js/settings-admin.js | 11 ++++-----
apps/files_encryption/templates/settings-admin.php | 4 ++--
3 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php
index 99cc7b3..57c4b41 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());
diff --git a/apps/files_encryption/js/settings-admin.js b/apps/files_encryption/js/settings-admin.js
index 38a5cd1..2242c1f 100644
--- a/apps/files_encryption/js/settings-admin.js
+++ b/apps/files_encryption/js/settings-admin.js
@@ -41,17 +41,14 @@ $(document).ready(function(){
$('button:button[name="submitChangeRecoveryKey"]').click(function() {
var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val();
var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val();
- OC.msg.startSaving('#encryption .msg');
+ var confirmNewPassword = $('#repeatedNewEncryptionRecoveryPassword').val();
+ OC.msg.startSaving('#encryptionChangeRecoveryKey .msg');
$.post(
OC.filePath( 'files_encryption', 'ajax', 'changeRecoveryPassword.php' )
- , { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword }
+ , { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword, confirmPassword: confirmNewPassword }
, function( data ) {
- if (data.status == "error") {
- OC.msg.finishedSaving('#encryption .msg', data);
- } else {
- OC.msg.finishedSaving('#encryption .msg', data);
+ OC.msg.finishedSaving('#encryptionChangeRecoveryKey .msg', data);
}
- }
);
});
diff --git a/apps/files_encryption/templates/settings-admin.php b/apps/files_encryption/templates/settings-admin.php
index acb2671..0acc282 100644
--- a/apps/files_encryption/templates/settings-admin.php
+++ b/apps/files_encryption/templates/settings-admin.php
@@ -32,8 +32,9 @@
</p>
<br/><br/>
- <p name="changeRecoveryPasswordBlock" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
+ <p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
<strong><?php p($l->t("Change recovery key password:")); ?></strong>
+ <span class="msg"></span>
<br/><br/>
<input
type="password"
@@ -59,7 +60,6 @@
name="submitChangeRecoveryKey">
<?php p($l->t("Change Password")); ?>
</button>
- <span class="msg"></span>
</p>
<?php endif; ?>
</form>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list