Add /p/ to the hash when adding a password

pull/1/head
yflory 5 years ago
parent 427cf836b1
commit fa2ad4e476

@ -1531,8 +1531,7 @@ define([
Store.leavePad = function (clientId, data, cb) { Store.leavePad = function (clientId, data, cb) {
var channel = channels[data.channel]; var channel = channels[data.channel];
if (!channel || !channel.cpNf) { return void cb ({error: 'EINVAL'}); } if (!channel || !channel.cpNf) { return void cb ({error: 'EINVAL'}); }
channel.cpNf.stop(); Store.dropChannel(data.channel);
delete channels[data.channel];
cb(); cb();
}; };
Store.sendPadMsg = function (clientId, data, cb) { Store.sendPadMsg = function (clientId, data, cb) {
@ -1850,7 +1849,7 @@ define([
// Clients management // Clients management
var driveEventClients = []; var driveEventClients = [];
var dropChannel = function (chanId) { var dropChannel = Store.dropChannel = function (chanId) {
try { try {
store.messenger.leavePad(chanId); store.messenger.leavePad(chanId);
} catch (e) { console.error(e); } } catch (e) { console.error(e); }

@ -174,7 +174,16 @@ define([
var parsed = Utils.Hash.parsePadUrl(window.location.href); var parsed = Utils.Hash.parsePadUrl(window.location.href);
var todo = function () { var todo = function () {
secret = Utils.secret = Utils.Hash.getSecrets(parsed.type, void 0, password); secret = Utils.secret = Utils.Hash.getSecrets(parsed.type, void 0, password);
Cryptpad.getShareHashes(secret, waitFor(function (err, h) { hashes = h; })); Cryptpad.getShareHashes(secret, waitFor(function (err, h) {
hashes = h;
if (password && !parsed.hashData.password) {
var ohc = window.onhashchange;
window.onhashchange = function () {};
window.location.hash = h.fileHash || h.editHash || h.viewHash || window.location.hash;
window.onhashchange = ohc;
ohc({reset: true});
}
}));
}; };
if (!parsed.hashData) { // No hash, no need to check for a password if (!parsed.hashData) { // No hash, no need to check for a password

Loading…
Cancel
Save