diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-21 12:01:56 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-21 12:01:56 +0200 |
commit | 4a2f8f81ca8dcc91c5b784077620517ec1011724 (patch) | |
tree | 5b6f5623b1d9da14b94e2d860bf1dbd63791bc49 /apps/encryption/js/settings-personal.js | |
parent | 55962c5f5ad0e03618a0a3c1267d72c8f607e2dd (diff) | |
download | nextcloud-server-4a2f8f81ca8dcc91c5b784077620517ec1011724.tar.gz nextcloud-server-4a2f8f81ca8dcc91c5b784077620517ec1011724.zip |
Don't pollute the global namespace
Diffstat (limited to 'apps/encryption/js/settings-personal.js')
-rw-r--r-- | apps/encryption/js/settings-personal.js | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/apps/encryption/js/settings-personal.js b/apps/encryption/js/settings-personal.js index 601bf22d78d..bf3aeaad915 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 updatePrivateKeyPassword() { - 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 @@ -45,7 +51,7 @@ $(document).ready(function(){ if (newPrivateKeyPassword !== '' && oldPrivateKeyPassword !== '' ) { $('button:button[name="submitChangePrivateKeyPassword"]').removeAttr("disabled"); if(event.which === 13) { - updatePrivateKeyPassword(); + OC.Encryption.updatePrivateKeyPassword(); } } else { $('button:button[name="submitChangePrivateKeyPassword"]').attr("disabled", "true"); @@ -53,7 +59,7 @@ $(document).ready(function(){ }); $('button:button[name="submitChangePrivateKeyPassword"]').click(function() { - updatePrivateKeyPassword(); + OC.Encryption.updatePrivateKeyPassword(); }); }); |