diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-08-18 20:51:48 +0400 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-08-18 20:51:48 +0400 |
commit | 9be836814cb4165ea54a086a0f97526d783bcd37 (patch) | |
tree | ad57d30194571edcf0f51cd83178b8ac2f03c0aa /settings/js | |
parent | c620c5840ab8ca45531c7639e086bafbd87d7365 (diff) | |
parent | d544a371bfb84f36a3b789d19d44d6694de21c48 (diff) |
Merge pull request #4239 from owncloud/decrypt_files_again
Enable user to decrypt files again after encryption app was disabled
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/personal.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index 099c1426dc0..94ef959488f 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -110,8 +110,62 @@ $(document).ready(function(){ }); return false; }); + + $('button:button[name="submitDecryptAll"]').click(function() { + 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.Encryption.msg.finishedDecrypting('#decryptAll .msg', data); + } else { + 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){ $(selector) |