Fix user logged out after registration

pull/1/head
yflory 4 years ago
parent 9d6cc55642
commit 8cc0f75f49

@ -2271,6 +2271,7 @@ define([
var channelIsReady = waitFor(); var channelIsReady = waitFor();
updateLocalVersion();
var msgEv = Util.mkEvent(); var msgEv = Util.mkEvent();
var postMsg, worker; var postMsg, worker;
@ -2504,7 +2505,6 @@ define([
AppConfig.afterLogin(common, waitFor()); AppConfig.afterLogin(common, waitFor());
} }
}).nThen(function () { }).nThen(function () {
updateLocalVersion();
f(void 0, env); f(void 0, env);
if (typeof(window.onhashchange) === 'function') { window.onhashchange(); } if (typeof(window.onhashchange) === 'function') { window.onhashchange(); }
}); });

@ -2687,7 +2687,8 @@ define([
// every user object should have a persistent, random number // every user object should have a persistent, random number
if (typeof(proxy.loginToken) !== 'number') { if (typeof(proxy.loginToken) !== 'number') {
proxy[Constants.tokenKey] = Math.floor(Math.random()*Number.MAX_SAFE_INTEGER); proxy[Constants.tokenKey] = store.data.localToken ||
Math.floor(Math.random()*Number.MAX_SAFE_INTEGER);
} }
returned[Constants.tokenKey] = proxy[Constants.tokenKey]; returned[Constants.tokenKey] = proxy[Constants.tokenKey];
@ -2848,11 +2849,14 @@ define([
store.driveMetadata = info.metadata; store.driveMetadata = info.metadata;
if (!rt.proxy.drive || typeof(rt.proxy.drive) !== 'object') { rt.proxy.drive = {}; } if (!rt.proxy.drive || typeof(rt.proxy.drive) !== 'object') { rt.proxy.drive = {}; }
var drive = rt.proxy.drive; var drive = rt.proxy.drive;
/*
// XXX deprecating localStorage migration
// Creating a new anon drive: import anon pads from localStorage // Creating a new anon drive: import anon pads from localStorage
if ((!drive[Constants.oldStorageKey] || !Array.isArray(drive[Constants.oldStorageKey])) if ((!drive[Constants.oldStorageKey] || !Array.isArray(drive[Constants.oldStorageKey]))
&& !drive['filesData']) { && !drive['filesData']) {
drive[Constants.oldStorageKey] = []; drive[Constants.oldStorageKey] = [];
} }
*/
// Drive already exist: return the existing drive, don't load data from legacy store // Drive already exist: return the existing drive, don't load data from legacy store
if (store.manager) { if (store.manager) {
// If a cache is loading, make sure it is complete before calling onReady // If a cache is loading, make sure it is complete before calling onReady

Loading…
Cancel
Save