|
|
|
@ -206,7 +206,7 @@ define([
|
|
|
|
|
// 2c: 'view' pad and '/p/' and a wrong password stored --> the seed is incorrect
|
|
|
|
|
// 2d: 'view' pad and '/p/' and password never stored (security feature) --> password-prompt
|
|
|
|
|
|
|
|
|
|
var askPassword = function (wrongPasswordStored) {
|
|
|
|
|
var askPassword = function (wrongPasswordStored, cfg) {
|
|
|
|
|
// Ask for the password and check if the pad exists
|
|
|
|
|
// If the pad doesn't exist, it means the password isn't correct
|
|
|
|
|
// or the pad has been deleted
|
|
|
|
@ -250,11 +250,14 @@ define([
|
|
|
|
|
// 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", cfg);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var done = waitFor();
|
|
|
|
|
var stored = false;
|
|
|
|
|
var passwordCfg = {
|
|
|
|
|
value: ''
|
|
|
|
|
};
|
|
|
|
|
nThen(function (w) {
|
|
|
|
|
Cryptpad.getPadAttribute('title', w(function (err, data) {
|
|
|
|
|
stored = (!err && typeof (data) === "string");
|
|
|
|
@ -264,7 +267,7 @@ define([
|
|
|
|
|
}), parsed.getUrl());
|
|
|
|
|
}).nThen(function (w) {
|
|
|
|
|
if (!password && !stored && sessionStorage.newPadPassword) {
|
|
|
|
|
password = sessionStorage.newPadPassword;
|
|
|
|
|
passwordCfg.value = sessionStorage.newPadPassword;
|
|
|
|
|
delete sessionStorage.newPadPassword;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -274,7 +277,7 @@ define([
|
|
|
|
|
Cryptpad.getFileSize(window.location.href, password, w(function (e, size) {
|
|
|
|
|
if (size !== 0) { return void todo(); }
|
|
|
|
|
// Wrong password or deleted file?
|
|
|
|
|
askPassword(true);
|
|
|
|
|
askPassword(true, passwordCfg);
|
|
|
|
|
}));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -293,7 +296,7 @@ define([
|
|
|
|
|
return void todo();
|
|
|
|
|
}
|
|
|
|
|
// Wrong password or deleted file?
|
|
|
|
|
askPassword(true);
|
|
|
|
|
askPassword(true, passwordCfg);
|
|
|
|
|
}));
|
|
|
|
|
}).nThen(done);
|
|
|
|
|
}
|
|
|
|
|