Fix logged in users seen as anonymous in some parts of the code

pull/1/head
yflory 4 years ago
parent b2a84ae3f7
commit 4401c7c519

@ -2484,6 +2484,9 @@ define([
data = data.returned; data = data.returned;
} }
if (data.loggedIn) {
window.CP_logged_in = true;
}
if (data.anonHash && !cfg.userHash) { LocalStore.setFSHash(data.anonHash); } if (data.anonHash && !cfg.userHash) { LocalStore.setFSHash(data.anonHash); }
initialized = true; initialized = true;

@ -2815,7 +2815,9 @@ define([
store.onRpcReadyEvt = Util.mkEvent(true); store.onRpcReadyEvt = Util.mkEvent(true);
store.loggedIn = typeof(data.userHash) !== "undefined"; store.loggedIn = typeof(data.userHash) !== "undefined";
var returned = {}; var returned = {
loggedIn: Boolean(data.userHash)
};
rt.proxy.on('create', function (info) { rt.proxy.on('create', function (info) {
store.realtime = info.realtime; store.realtime = info.realtime;
store.network = info.network; store.network = info.network;

@ -73,7 +73,7 @@ define([
}; };
LocalStore.isLoggedIn = function () { LocalStore.isLoggedIn = function () {
return typeof getUserHash() === "string"; return window.CP_logged_in || typeof getUserHash() === "string";
}; };
LocalStore.login = function (hash, name, cb) { LocalStore.login = function (hash, name, cb) {

Loading…
Cancel
Save