mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Don't pollute the global namespace
This commit is contained in:
parent
55962c5f5a
commit
4a2f8f81ca
3 changed files with 45 additions and 34 deletions
|
|
@ -5,27 +5,30 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
|
||||
function displayEncryptionWarning () {
|
||||
|
||||
if (!OC.Notification.isHidden()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.get(
|
||||
OC.generateUrl('/apps/encryption/ajax/getStatus'),
|
||||
function( result ) {
|
||||
if (result.status === "success") {
|
||||
OC.Notification.show(result.data.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!OC.Encryption) {
|
||||
OC.Encryption = {};
|
||||
}
|
||||
|
||||
OC.Encryption = {
|
||||
displayEncryptionWarning: function () {
|
||||
if (!OC.Notification.isHidden()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.get(
|
||||
OC.generateUrl('/apps/encryption/ajax/getStatus'),
|
||||
function (result) {
|
||||
if (result.status === "success") {
|
||||
OC.Notification.show(result.data.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
$(document).ready(function() {
|
||||
// wait for other apps/extensions to register their event handlers and file actions
|
||||
// in the "ready" clause
|
||||
_.defer(function() {
|
||||
displayEncryptionWarning();
|
||||
OC.Encryption.displayEncryptionWarning();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -330,8 +330,9 @@ $(document).ready(function () {
|
|||
|
||||
$('#sslCertificate tbody').append(row);
|
||||
},
|
||||
fail: function (e, data) {
|
||||
OC.Notification.showTemporary(t('settings', 'An error occured. Please upload an ASCII-encoded PEM certificate.'));
|
||||
fail: function () {
|
||||
OC.Notification.showTemporary(
|
||||
t('settings', 'An error occurred. Please upload an ASCII-encoded PEM certificate.'));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -340,8 +341,9 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
OC.Encryption = {
|
||||
};
|
||||
if (!OC.Encryption) {
|
||||
OC.Encryption = {};
|
||||
}
|
||||
|
||||
OC.Encryption.msg = {
|
||||
start: function (selector, msg) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue