diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-07 12:06:46 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-07 12:32:09 +0200 |
commit | 5fa1cbc4e5aa0c0127713859291a0b14a8b8e348 (patch) | |
tree | 1fca9cf2185fb2b20be2b07b2d77d6606fc2c5bf /apps/files_encryption/js | |
parent | 94a9ff1cd8b18577e16bde90146b0be84223d725 (diff) | |
download | nextcloud-server-5fa1cbc4e5aa0c0127713859291a0b14a8b8e348.tar.gz nextcloud-server-5fa1cbc4e5aa0c0127713859291a0b14a8b8e348.zip |
improved visual feedback if recovery key gets enabled/disabled
Diffstat (limited to 'apps/files_encryption/js')
-rw-r--r-- | apps/files_encryption/js/settings-admin.js | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/apps/files_encryption/js/settings-admin.js b/apps/files_encryption/js/settings-admin.js index 4c6b1bac2f7..38a5cd1b556 100644 --- a/apps/files_encryption/js/settings-admin.js +++ b/apps/files_encryption/js/settings-admin.js @@ -9,32 +9,21 @@ $(document).ready(function(){ - $('input:password[name="encryptionRecoveryPassword"]').keyup(function(event) { - var recoveryPassword = $( '#encryptionRecoveryPassword' ).val(); - var recoveryPasswordRepeated = $( '#repeatEncryptionRecoveryPassword' ).val(); - var checkedButton = $('input:radio[name="adminEnableRecovery"]:checked').val(); - var uncheckedValue = (1+parseInt(checkedButton)) % 2; - if (recoveryPassword !== '' && recoveryPassword === recoveryPasswordRepeated) { - $('input:radio[name="adminEnableRecovery"][value="'+uncheckedValue.toString()+'"]').removeAttr("disabled"); - } else { - $('input:radio[name="adminEnableRecovery"][value="'+uncheckedValue.toString()+'"]').attr("disabled", "true"); - } - }); - $( 'input:radio[name="adminEnableRecovery"]' ).change( function() { var recoveryStatus = $( this ).val(); var oldStatus = (1+parseInt(recoveryStatus)) % 2; var recoveryPassword = $( '#encryptionRecoveryPassword' ).val(); + var confirmPassword = $( '#repeatEncryptionRecoveryPassword' ).val(); + OC.msg.startSaving('#encryptionSetRecoveryKey .msg'); $.post( OC.filePath( 'files_encryption', 'ajax', 'adminrecovery.php' ) - , { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword } + , { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword, confirmPassword: confirmPassword } , function( result ) { + OC.msg.finishedSaving('#encryptionSetRecoveryKey .msg', result); if (result.status === "error") { - OC.Notification.show(t('admin', result.data.message)); $('input:radio[name="adminEnableRecovery"][value="'+oldStatus.toString()+'"]').attr("checked", "true"); } else { - OC.Notification.hide(); if (recoveryStatus === "0") { $('p[name="changeRecoveryPasswordBlock"]').addClass("hidden"); } else { @@ -49,19 +38,6 @@ $(document).ready(function(){ // change recovery password - $('input:password[name="changeRecoveryPassword"]').keyup(function(event) { - var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val(); - var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val(); - var newRecoveryPasswordRepeated = $('#repeatedNewEncryptionRecoveryPassword').val(); - - if (newRecoveryPassword !== '' && oldRecoveryPassword !== '' && newRecoveryPassword === newRecoveryPasswordRepeated) { - $('button:button[name="submitChangeRecoveryKey"]').removeAttr("disabled"); - } else { - $('button:button[name="submitChangeRecoveryKey"]').attr("disabled", "true"); - } - }); - - $('button:button[name="submitChangeRecoveryKey"]').click(function() { var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val(); var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val(); |