summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-07-29 17:06:05 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-07-29 17:06:05 +0200
commitb6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd (patch)
tree2ca892180568bd5c76facbfd9e6762621485a5dd /settings/js
parent830f5d24c77b863bd49eda0cbc4ba812add8065d (diff)
downloadnextcloud-server-b6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd.tar.gz
nextcloud-server-b6fa0e4eefb332dc1fb9b45df50de4621ed8e6bd.zip
working decrypt files method
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/personal.js57
1 files changed, 49 insertions, 8 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 97342e7653e..94ef959488f 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -112,18 +112,59 @@ $(document).ready(function(){
});
$('button:button[name="submitDecryptAll"]').click(function() {
- console.log("click!");
- $.post('ajax/decryptall.php', {}, function(data) {
- /*
+ var privateKeyPassword = $('#decryptAll input:password[id="privateKeyPassword"]').val();
+ OC.Encryption.decryptAll(privateKeyPassword);
+ });
+
+ $('#decryptAll input:password[name="privateKeyPassword"]').keyup(function(event) {
+ var privateKeyPassword = $('#decryptAll input:password[id="privateKeyPassword"]').val();
+ if (privateKeyPassword !== '' ) {
+ $('#decryptAll button:button[name="submitDecryptAll"]').removeAttr("disabled");
+ if(event.which === 13) {
+ OC.Encryption.decryptAll(privateKeyPassword);
+ }
+ } else {
+ $('#decryptAll button:button[name="submitDecryptAll"]').attr("disabled", "true");
+ }
+ });
+
+} );
+
+OC.Encryption = {
+ decryptAll: function(password) {
+ OC.Encryption.msg.startDecrypting('#decryptAll .msg');
+ $.post('ajax/decryptall.php', {password:password}, function(data) {
if (data.status === "error") {
- OC.msg.finishedSaving('#encryption .msg', data);
+ OC.Encryption.msg.finishedDecrypting('#decryptAll .msg', data);
} else {
- OC.msg.finishedSaving('#encryption .msg', data);
- }*/
+ OC.Encryption.msg.finishedDecrypting('#decryptAll .msg', data);
+ }
}
);
- });
-} );
+ }
+}
+
+OC.Encryption.msg={
+ startDecrypting:function(selector){
+ $(selector)
+ .html( t('files_encryption', 'Decrypting files... Please wait, this can take some time.') )
+ .removeClass('success')
+ .removeClass('error')
+ .stop(true, true)
+ .show();
+ },
+ finishedDecrypting:function(selector, data){
+ if( data.status === "success" ){
+ $(selector).html( data.data.message )
+ .addClass('success')
+ .stop(true, true)
+ .delay(3000)
+ .fadeOut(900);
+ }else{
+ $(selector).html( data.data.message ).addClass('error');
+ }
+ }
+};
OC.msg={
startSaving:function(selector){