after changing password, encryption key changed so current encryption session is invalid and needs to be cleared

This commit is contained in:
azivner 2017-09-12 23:07:08 -04:00
parent 5b84487aac
commit 4e298d9d85
2 changed files with 17 additions and 10 deletions

View File

@ -115,8 +115,7 @@ $("#encryptionPasswordForm").submit(function() {
return false;
});
setInterval(function() {
if (globalLastEncryptionOperationDate !== null && new Date().getTime() - globalLastEncryptionOperationDate.getTime() > globalEncryptionSessionTimeout * 1000) {
function resetEncryptionSession() {
globalEncryptionKey = null;
if (globalCurrentNote.detail.encryption > 0) {
@ -131,6 +130,11 @@ setInterval(function() {
}
}
}
setInterval(function() {
if (globalLastEncryptionOperationDate !== null && new Date().getTime() - globalLastEncryptionOperationDate.getTime() > globalEncryptionSessionTimeout * 1000) {
resetEncryptionSession();
}
}, 5000);
function isEncryptionAvailable() {

View File

@ -40,6 +40,9 @@ $("#changePasswordForm").submit(() => {
contentType: "application/json",
success: function (result) {
if (result.success) {
// encryption password changed so current encryption session is invalid and needs to be cleared
resetEncryptionSession();
alert("Password has been changed.");
}
else {