Fix password prompt issue when the password was wrong in the file app

pull/1/head
yflory 7 years ago
parent 05bd41f256
commit a6bac8ae41

@ -150,12 +150,12 @@ define([
todo(); todo();
} else { } else {
// Ask for the password and check if the pad exists // Ask for the password and check if the pad exists
// If the pad doesn't exist, it means the password is oncorrect // If the pad doesn't exist, it means the password isn't correct
// or the pad has been deleted // or the pad has been deleted
var correctPassword = waitFor(); var correctPassword = waitFor();
sframeChan.on('Q_PAD_PASSWORD_VALUE', function (data, cb) { sframeChan.on('Q_PAD_PASSWORD_VALUE', function (data, cb) {
password = data; password = data;
Cryptpad.isNewChannel(window.location.href, password, function (e, isNew) { var next = function (e, isNew) {
if (Boolean(isNew)) { if (Boolean(isNew)) {
// Ask again in the inner iframe // Ask again in the inner iframe
// We should receive a new Q_PAD_PASSWORD_VALUE // We should receive a new Q_PAD_PASSWORD_VALUE
@ -165,7 +165,17 @@ define([
correctPassword(); correctPassword();
cb(true); cb(true);
} }
}); };
if (parsed.type === "file") {
// `isNewChannel` doesn't work for files (not a channel)
// `getFileSize` is not adapted to channels because of metadata
Cryptpad.getFileSize(window.location.href, password, function (e, size) {
next(e, size === 0);
});
return;
}
// Not a file, so we can use `isNewChannel`
Cryptpad.isNewChannel(window.location.href, password, next);
}); });
sframeChan.event("EV_PAD_PASSWORD"); sframeChan.event("EV_PAD_PASSWORD");
} }

Loading…
Cancel
Save