diff options
Diffstat (limited to 'settings/js/personal.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) |