summaryrefslogtreecommitdiffstats
path: root/apps/encryption/js/settings-admin.js
diff options
context:
space:
mode:
authorClark Tomlinson <fallen013@gmail.com>2015-03-26 20:35:36 -0400
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:27 +0200
commitd15c2e52b0576e7846a09fd84e0e10f3054623c6 (patch)
treef027d9cb18160353fe440e4eef48be8aa7cdea99 /apps/encryption/js/settings-admin.js
parent2e00acda079644ce4eb61b8a3812b095df8d05e3 (diff)
downloadnextcloud-server-d15c2e52b0576e7846a09fd84e0e10f3054623c6.tar.gz
nextcloud-server-d15c2e52b0576e7846a09fd84e0e10f3054623c6.zip
cleanup and removing cachefactory
Diffstat (limited to 'apps/encryption/js/settings-admin.js')
-rw-r--r--apps/encryption/js/settings-admin.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/encryption/js/settings-admin.js b/apps/encryption/js/settings-admin.js
new file mode 100644
index 00000000000..2242c1f7124
--- /dev/null
+++ b/apps/encryption/js/settings-admin.js
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2013
+ * Sam Tuke <samtuke@owncloud.com>
+ * Robin Appelman <icewind1991@gmail.com>
+ * Bjoern Schiessle <schiessle@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+$(document).ready(function(){
+
+ $( '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, confirmPassword: confirmPassword }
+ , function( result ) {
+ OC.msg.finishedSaving('#encryptionSetRecoveryKey .msg', result);
+ if (result.status === "error") {
+ $('input:radio[name="adminEnableRecovery"][value="'+oldStatus.toString()+'"]').attr("checked", "true");
+ } else {
+ if (recoveryStatus === "0") {
+ $('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
+ } else {
+ $('input:password[name="changeRecoveryPassword"]').val("");
+ $('p[name="changeRecoveryPasswordBlock"]').removeClass("hidden");
+ }
+ }
+ }
+ );
+ }
+ );
+
+ // change recovery password
+
+ $('button:button[name="submitChangeRecoveryKey"]').click(function() {
+ var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val();
+ var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val();
+ var confirmNewPassword = $('#repeatedNewEncryptionRecoveryPassword').val();
+ OC.msg.startSaving('#encryptionChangeRecoveryKey .msg');
+ $.post(
+ OC.filePath( 'files_encryption', 'ajax', 'changeRecoveryPassword.php' )
+ , { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword, confirmPassword: confirmNewPassword }
+ , function( data ) {
+ OC.msg.finishedSaving('#encryptionChangeRecoveryKey .msg', data);
+ }
+ );
+ });
+
+});