mirror of https://github.com/xwiki-labs/cryptpad
Fix OnlyOffice documents password change #1262
This commit is contained in:
parent
17316e54d6
commit
ad3f25cf40
|
@ -1790,8 +1790,8 @@ define([
|
||||||
var newCrypto = Crypto.createEncryptor(newSecret.keys);
|
var newCrypto = Crypto.createEncryptor(newSecret.keys);
|
||||||
var oldCrypto = Crypto.createEncryptor(oldSecret.keys);
|
var oldCrypto = Crypto.createEncryptor(oldSecret.keys);
|
||||||
var cps = Util.find(cryptgetVal, ['content', 'hashes']);
|
var cps = Util.find(cryptgetVal, ['content', 'hashes']);
|
||||||
var l = Object.keys(cps).length;
|
var cpLength = Object.keys(cps).length;
|
||||||
var lastCp = l ? cps[l] : {};
|
var lastCp = cpLength ? cps[cpLength] : {};
|
||||||
cryptgetVal.content.hashes = {};
|
cryptgetVal.content.hashes = {};
|
||||||
common.getHistory({
|
common.getHistory({
|
||||||
channel: oldRtChannel,
|
channel: oldRtChannel,
|
||||||
|
@ -1814,7 +1814,7 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Update last knwon hash in cryptgetVal
|
// Update last knwon hash in cryptgetVal
|
||||||
if (lastCp) {
|
if (cpLength && newHistory.length) {
|
||||||
lastCp.hash = newHistory[0].slice(0, 64);
|
lastCp.hash = newHistory[0].slice(0, 64);
|
||||||
lastCp.index = 50;
|
lastCp.index = 50;
|
||||||
cryptgetVal.content.hashes[1] = lastCp;
|
cryptgetVal.content.hashes[1] = lastCp;
|
||||||
|
@ -1839,6 +1839,7 @@ define([
|
||||||
// The new rt channel is ready
|
// The new rt channel is ready
|
||||||
// The blob uses its own encryption and doesn't need to be reencrypted
|
// The blob uses its own encryption and doesn't need to be reencrypted
|
||||||
cryptgetVal.content.channel = newRtChannel;
|
cryptgetVal.content.channel = newRtChannel;
|
||||||
|
if (!newPassword) { optsPut.metadata.forcePlaceholder = true; }
|
||||||
Crypt.put(newHash, JSON.stringify(cryptgetVal), waitFor(function (err) {
|
Crypt.put(newHash, JSON.stringify(cryptgetVal), waitFor(function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
waitFor.abort();
|
waitFor.abort();
|
||||||
|
|
Loading…
Reference in New Issue