[Pkg-owncloud-commits] [owncloud] 210/258: improved visual feedback if user enabled recovery key

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 a766f5b6334c529e33c34d36598b408a11b76576
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Tue Oct 7 12:52:01 2014 +0200

    improved visual feedback if user enabled recovery key
---
 apps/files_encryption/ajax/userrecovery.php         |  8 +++++++-
 apps/files_encryption/js/settings-personal.js       | 21 ++++++---------------
 .../templates/settings-personal.php                 |  5 ++---
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/apps/files_encryption/ajax/userrecovery.php b/apps/files_encryption/ajax/userrecovery.php
index 0f3b973..a5b89fa 100644
--- a/apps/files_encryption/ajax/userrecovery.php
+++ b/apps/files_encryption/ajax/userrecovery.php
@@ -13,6 +13,8 @@ use OCA\Encryption;
 \OCP\JSON::checkAppEnabled('files_encryption');
 \OCP\JSON::callCheck();
 
+$l = \OC::$server->getL10N('files_encryption');
+
 if (
 	isset($_POST['userEnableRecovery'])
 	&& (0 == $_POST['userEnableRecovery'] || '1' === $_POST['userEnableRecovery'])
@@ -38,4 +40,8 @@ if (
 }
 
 // Return success or failure
-($return) ? \OCP\JSON::success() : \OCP\JSON::error();
+if ($return) {
+	\OCP\JSON::success(array('data' => array('message' => $l->t('File recovery settings updated'))));
+} else {
+	\OCP\JSON::error(array('data' => array('message' => $l->t('Could not update file recovery'))));
+}
diff --git a/apps/files_encryption/js/settings-personal.js b/apps/files_encryption/js/settings-personal.js
index f857c2c..b798ba7 100644
--- a/apps/files_encryption/js/settings-personal.js
+++ b/apps/files_encryption/js/settings-personal.js
@@ -26,36 +26,27 @@ $(document).ready(function(){
 	// Trigger ajax on recoveryAdmin status change
 	$( 'input:radio[name="userEnableRecovery"]' ).change(
 		function() {
-			
-			// Hide feedback messages in case they're already visible
-			$('#recoveryEnabledSuccess').hide();
-			$('#recoveryEnabledError').hide();
-			
 			var recoveryStatus = $( this ).val();
-			
+			OC.msg.startAction('#userEnableRecovery .msg', 'Updating recovery keys. This can take some time...');
 			$.post(
 				OC.filePath( 'files_encryption', 'ajax', 'userrecovery.php' )
 				, { userEnableRecovery: recoveryStatus }
 				,  function( data ) {
-					if ( data.status == "success" ) {
-						$('#recoveryEnabledSuccess').show();
-					} else {
-						$('#recoveryEnabledError').show();
-					}
+					OC.msg.finishedAction('#userEnableRecovery .msg', data);
 				}
 			);
 			// Ensure page is not reloaded on form submit
 			return false;
 		}
 	);
-	
+
 	$("#encryptAll").click(
 		function(){
-			
+
 			// Hide feedback messages in case they're already visible
 			$('#encryptAllSuccess').hide();
 			$('#encryptAllError').hide();
-			
+
 			var userPassword = $( '#userPassword' ).val();
 			var encryptAll = $( '#encryptAll' ).val();
 
@@ -73,7 +64,7 @@ $(document).ready(function(){
 			// Ensure page is not reloaded on form submit
 			return false;
 		}
-		
+
 	);
 
 	// update private key password
diff --git a/apps/files_encryption/templates/settings-personal.php b/apps/files_encryption/templates/settings-personal.php
index 832eb75..5f11e00 100644
--- a/apps/files_encryption/templates/settings-personal.php
+++ b/apps/files_encryption/templates/settings-personal.php
@@ -39,8 +39,9 @@
 
 	<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] &&  $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
 		<br />
-		<p>
+		<p id="userEnableRecovery">
 			<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
+			<span class="msg"></span>
 			<br />
 			<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
 			<br />
@@ -58,8 +59,6 @@
 			value='0'
 			<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
 			<?php p( $l->t( "Disabled" ) ); ?>
-			<div id="recoveryEnabledSuccess"><?php p( $l->t( 'File recovery settings updated' ) ); ?></div>
-			<div id="recoveryEnabledError"><?php p( $l->t( 'Could not update file recovery' ) ); ?></div>
 		</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