summaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-04-21 12:47:43 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-04-21 12:47:43 +0200
commit4b968da9e64c4bfbdd166caaff4fab9bfc47a182 (patch)
treeb00eae846df6397eec0ad5fad77b45dff0286c50 /apps/encryption
parentb0fcf0fa0ee8846e2ba35ede5968ed0227c5675d (diff)
parent490e779424178977c143eba94a139f249eb2416f (diff)
downloadnextcloud-server-4b968da9e64c4bfbdd166caaff4fab9bfc47a182.tar.gz
nextcloud-server-4b968da9e64c4bfbdd166caaff4fab9bfc47a182.zip
Merge pull request #15713 from owncloud/fix-15707-master
[enc2] Fixing JS errors
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/js/encryption.js17
-rw-r--r--apps/encryption/js/settings-admin.js19
-rw-r--r--apps/encryption/js/settings-personal.js40
3 files changed, 41 insertions, 35 deletions
diff --git a/apps/encryption/js/encryption.js b/apps/encryption/js/encryption.js
index c02b4d74ae8..7ed49f77311 100644
--- a/apps/encryption/js/encryption.js
+++ b/apps/encryption/js/encryption.js
@@ -5,25 +5,23 @@
* See the COPYING-README file.
*/
+if (!OC.Encryption) {
+ OC.Encryption = {};
+}
+
/**
* @namespace
* @memberOf OC
*/
-OC.Encryption= {
- MIGRATION_OPEN: 0,
- MIGRATION_COMPLETED: 1,
- MIGRATION_IN_PROGRESS: -1,
-
-
+OC.Encryption = {
displayEncryptionWarning: function () {
-
if (!OC.Notification.isHidden()) {
return;
}
$.get(
- OC.generateUrl('/apps/encryption/ajax/getStatus')
- , function( result ) {
+ OC.generateUrl('/apps/encryption/ajax/getStatus'),
+ function (result) {
if (result.status === "success") {
OC.Notification.show(result.data.message);
}
@@ -31,7 +29,6 @@ OC.Encryption= {
);
}
};
-
$(document).ready(function() {
// wait for other apps/extensions to register their event handlers and file actions
// in the "ready" clause
diff --git a/apps/encryption/js/settings-admin.js b/apps/encryption/js/settings-admin.js
index 36765adf3e4..bb539f6a4e2 100644
--- a/apps/encryption/js/settings-admin.js
+++ b/apps/encryption/js/settings-admin.js
@@ -12,17 +12,20 @@ $(document).ready(function(){
$( 'input:radio[name="adminEnableRecovery"]' ).change(
function() {
var recoveryStatus = $( this ).val();
- var oldStatus = (1+parseInt(recoveryStatus)) % 2;
+ var oldStatus = (1+parseInt(recoveryStatus, 10)) % 2;
var recoveryPassword = $( '#encryptionRecoveryPassword' ).val();
var confirmPassword = $( '#repeatEncryptionRecoveryPassword' ).val();
OC.msg.startSaving('#encryptionSetRecoveryKey .msg');
$.post(
- OC.generateUrl('/apps/encryption/ajax/adminRecovery')
- , { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword, confirmPassword: confirmPassword }
- , function( result ) {
+ OC.generateUrl('/apps/encryption/ajax/adminRecovery'),
+ { 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");
+ $('input:radio[name="adminEnableRecovery"][value="'+oldStatus.toString()+'"]')
+ .attr("checked", "true");
} else {
if (recoveryStatus === "0") {
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
@@ -44,9 +47,9 @@ $(document).ready(function(){
var confirmNewPassword = $('#repeatedNewEncryptionRecoveryPassword').val();
OC.msg.startSaving('#encryptionChangeRecoveryKey .msg');
$.post(
- OC.generateUrl('/apps/encryption/ajax/changeRecoveryPassword')
- , { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword, confirmPassword: confirmNewPassword }
- , function( data ) {
+ OC.generateUrl('/apps/encryption/ajax/changeRecoveryPassword'),
+ { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword, confirmPassword: confirmNewPassword },
+ function( data ) {
OC.msg.finishedSaving('#encryptionChangeRecoveryKey .msg', data);
}
);
diff --git a/apps/encryption/js/settings-personal.js b/apps/encryption/js/settings-personal.js
index 68609877c05..e36f10a244e 100644
--- a/apps/encryption/js/settings-personal.js
+++ b/apps/encryption/js/settings-personal.js
@@ -4,20 +4,26 @@
* See the COPYING-README file.
*/
-function updatePrivateKeyPasswd() {
- var oldPrivateKeyPassword = $('input:password[id="oldPrivateKeyPassword"]').val();
- var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val();
- OC.msg.startSaving('#encryption .msg');
- $.post(
- OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword'),
- { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
- ).success(function(response) {
- OC.msg.finishedSuccess('#encryption .msg', response.message);
- }).fail(function(response) {
- OC.msg.finishedError('#encryption .msg', response.responseJSON.message);
- });
+if (!OC.Encryption) {
+ OC.Encryption = {};
}
+OC.Encryption = {
+ updatePrivateKeyPassword: function() {
+ var oldPrivateKeyPassword = $('input:password[id="oldPrivateKeyPassword"]').val();
+ var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val();
+ OC.msg.startSaving('#encryption .msg');
+ $.post(
+ OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword'),
+ {oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword}
+ ).success(function (response) {
+ OC.msg.finishedSuccess('#encryption .msg', response.message);
+ }).fail(function (response) {
+ OC.msg.finishedError('#encryption .msg', response.responseJSON.message);
+ });
+ }
+};
+
$(document).ready(function(){
// Trigger ajax on recoveryAdmin status change
@@ -26,9 +32,9 @@ $(document).ready(function(){
var recoveryStatus = $( this ).val();
OC.msg.startAction('#userEnableRecovery .msg', 'Updating recovery keys. This can take some time...');
$.post(
- OC.generateUrl('/apps/encryption/ajax/userSetRecovery')
- , { userEnableRecovery: recoveryStatus }
- , function( data ) {
+ OC.generateUrl('/apps/encryption/ajax/userSetRecovery'),
+ { userEnableRecovery: recoveryStatus },
+ function( data ) {
OC.msg.finishedAction('#userEnableRecovery .msg', data);
}
);
@@ -45,7 +51,7 @@ $(document).ready(function(){
if (newPrivateKeyPassword !== '' && oldPrivateKeyPassword !== '' ) {
$('button:button[name="submitChangePrivateKeyPassword"]').removeAttr("disabled");
if(event.which === 13) {
- updatePrivateKeyPasswd();
+ OC.Encryption.updatePrivateKeyPassword();
}
} else {
$('button:button[name="submitChangePrivateKeyPassword"]').attr("disabled", "true");
@@ -53,7 +59,7 @@ $(document).ready(function(){
});
$('button:button[name="submitChangePrivateKeyPassword"]').click(function() {
- updatePrivateKeyPasswd();
+ OC.Encryption.updatePrivateKeyPassword();
});
});