From 1ac0cd3e1d15ed511d98f274012fb8ffd51a29ed Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 12 Jul 2024 17:59:50 +0200 Subject: [PATCH] Use the correct password when sharing a pad to a contact - Fix #1270; - Force reload option added. --- www/common/cryptpad-common.js | 3 ++- www/common/notifications.js | 1 + www/common/outer/mailbox-handlers.js | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 4525c8287..e2d6a3746 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -2619,7 +2619,8 @@ define([ disableCache: localStorage['CRYPTPAD_STORE|disableCache'], driveEvents: !rdyCfg.noDrive, //rdyCfg.driveEvents // Boolean lastVisit: Number(localStorage.lastVisit) || undefined, - blockId: blockId + blockId: blockId, + blockHash: blockHash }; common.userHash = userHash || LocalStore.getUserHash(); diff --git a/www/common/notifications.js b/www/common/notifications.js index 82fb4b45d..8ec80c2e9 100644 --- a/www/common/notifications.js +++ b/www/common/notifications.js @@ -129,6 +129,7 @@ define([ var obj = { p: msg.content.isTemplate ? ['template'] : undefined, t: teamNotification || undefined, + f: 1, pw: msg.content.password || '' }; common.openURL(Hash.getNewPadURL(msg.content.href, obj)); diff --git a/www/common/outer/mailbox-handlers.js b/www/common/outer/mailbox-handlers.js index a2b2ed08a..06de11374 100644 --- a/www/common/outer/mailbox-handlers.js +++ b/www/common/outer/mailbox-handlers.js @@ -8,7 +8,8 @@ define([ '/common/common-hash.js', '/common/common-util.js', '/components/chainpad-crypto/crypto.js', -], function (ApiConfig, Messaging, Hash, Util, Crypto) { + '/common/outer/login-block.js', + ], function (ApiConfig, Messaging, Hash, Util, Crypto, Block) { // Random timeout between 10 and 30 times your sync time (lag + chainpad sync) var getRandomTimeout = function (ctx) { @@ -265,7 +266,9 @@ define([ } if (content.password) { - var key = ctx.store.driveSecret.keys.cryptKey; + var uHash = ctx.store.data.blockHash; + var uSecret = Block.parseBlockHash(uHash); + var key = uSecret.keys.symmetric; content.password = Crypto.encrypt(content.password, key); }