diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2012-08-09 12:19:51 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2012-08-09 12:19:51 +0200 |
commit | 5a261b5b8ffd01c34ce009a431a5587c548fa9a7 (patch) | |
tree | 4d178eb6b8c63db84953b4219a27a6aca42b242c /apps/files_encryption/js | |
parent | a7cbc9e71398d5e08684ffdfd1f07e7d8defbf31 (diff) | |
download | nextcloud-server-5a261b5b8ffd01c34ce009a431a5587c548fa9a7.tar.gz nextcloud-server-5a261b5b8ffd01c34ce009a431a5587c548fa9a7.zip |
ask user for passwords when switching from client to server side encryption
Diffstat (limited to 'apps/files_encryption/js')
-rw-r--r-- | apps/files_encryption/js/settings-personal.js | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/apps/files_encryption/js/settings-personal.js b/apps/files_encryption/js/settings-personal.js index 6d3c9f9a486..fad077a8dd7 100644 --- a/apps/files_encryption/js/settings-personal.js +++ b/apps/files_encryption/js/settings-personal.js @@ -6,16 +6,33 @@ $(document).ready(function(){ $('input[name=encryption_mode]').change(function(){ + var prevmode = document.getElementById('prev_encryption_mode').value var client=$('input[value="client"]:checked').val() ,server=$('input[value="server"]:checked').val() ,user=$('input[value="user"]:checked').val() ,none=$('input[value="none"]:checked').val() - if (client) - var encmode= 'client'; - else if (server) - var encmode = 'server'; - else - var encmode = 'none'; - $.post(OC.filePath('files_encryption', 'ajax', 'mode.php'), { mode: encmode }); + if (client) { + $.post(OC.filePath('files_encryption', 'ajax', 'mode.php'), { mode: 'client' }); + if (prevmode == 'server') { + OC.dialogs.info(t('encryption', 'Please go to your owncloud client and change your encryption password to complete the conversion'), t('encryption', 'switched to client side encryption')); + } + } else if (server) { + if (prevmode == 'client') { + OC.dialogs.form([{text:'login password', name:'newpasswd', type:'password'},{text:'Encryption password used on the client', name:'oldpasswd', type:'password'}],t('encryption', 'Please enter your passwords'), function(data) { + $.post(OC.filePath('files_encryption', 'ajax', 'mode.php'), { mode: 'server', newpasswd: data[0].value, oldpasswd: data[1].value }, function(result) { + if (result.status != 'success') { + console.log("change selection back to " + prevmode+'_encryption'); + document.getElementById(prevmode+'_encryption').checked = true; + } else { + } + + }); + }); + } else { + $.post(OC.filePath('files_encryption', 'ajax', 'mode.php'), { mode: 'server' }); + } + } else { + $.post(OC.filePath('files_encryption', 'ajax', 'mode.php'), { mode: 'none' }); + } }) })
\ No newline at end of file |