Load shared folder when not logged in

This commit is contained in:
yflory
2018-09-28 15:06:24 +02:00
parent 0e04c4392c
commit 17bc1ee703
4 changed files with 21 additions and 1 deletions

View File

@@ -39,7 +39,7 @@ define([
var getSecrets = function (Cryptpad, Utils, cb) {
var hash = window.location.hash.slice(1);
var secret = Utils.Hash.getSecrets('drive', hash);
if (hash) {
if (hash && Utils.LocalStore.isLoggedIn()) {
// Add a shared folder!
// TODO password?
Cryptpad.addSharedFolder(secret, function (id) {
@@ -53,6 +53,16 @@ define([
cb(null, secret);
});
return;
} else if (hash) {
var id = Utils.Util.createRandomInteger();
window.CryptPad_newSharedFolder = id;
var data = {
href: Utils.Hash.getRelativeHref(window.location.href),
};
Cryptpad.loadSharedFolder(id, data, function () {
cb(null, secret);
});
return;
}
// No password for drive
cb(null, secret);