2015-03-27 00:35:36 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2013, Sam Tuke <samtuke@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or later.
|
|
|
|
* 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(
|
2015-03-31 15:13:36 +00:00
|
|
|
OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword')
|
2015-03-27 00:35:36 +00:00
|
|
|
, { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
|
|
|
|
, function( data ) {
|
|
|
|
if (data.status === "error") {
|
|
|
|
OC.msg.finishedSaving('#encryption .msg', data);
|
|
|
|
} else {
|
|
|
|
OC.msg.finishedSaving('#encryption .msg', data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
// Trigger ajax on recoveryAdmin status change
|
|
|
|
$( 'input:radio[name="userEnableRecovery"]' ).change(
|
|
|
|
function() {
|
|
|
|
var recoveryStatus = $( this ).val();
|
|
|
|
OC.msg.startAction('#userEnableRecovery .msg', 'Updating recovery keys. This can take some time...');
|
|
|
|
$.post(
|
2015-03-31 14:23:31 +00:00
|
|
|
OC.generateUrl('/apps/encryption/ajax/userSetRecovery')
|
2015-03-27 00:35:36 +00:00
|
|
|
, { userEnableRecovery: recoveryStatus }
|
|
|
|
, function( data ) {
|
|
|
|
OC.msg.finishedAction('#userEnableRecovery .msg', data);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
// Ensure page is not reloaded on form submit
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// update private key password
|
|
|
|
|
|
|
|
$('input:password[name="changePrivateKeyPassword"]').keyup(function(event) {
|
|
|
|
var oldPrivateKeyPassword = $('input:password[id="oldPrivateKeyPassword"]').val();
|
|
|
|
var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val();
|
|
|
|
if (newPrivateKeyPassword !== '' && oldPrivateKeyPassword !== '' ) {
|
|
|
|
$('button:button[name="submitChangePrivateKeyPassword"]').removeAttr("disabled");
|
|
|
|
if(event.which === 13) {
|
|
|
|
updatePrivateKeyPasswd();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$('button:button[name="submitChangePrivateKeyPassword"]').attr("disabled", "true");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('button:button[name="submitChangePrivateKeyPassword"]').click(function() {
|
|
|
|
updatePrivateKeyPasswd();
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|