Don't redirect until realtime is synced when logging in

pull/1/head
yflory 8 years ago
parent 0c1efd361b
commit a8d200ef2e

@ -132,9 +132,11 @@ define([
if (result.proxy && !result.proxy.login_name) {
result.proxy.login_name = result.userName;
}
Cryptpad.whenRealtimeSyncs(result.realtime, function () {
Cryptpad.login(result.userHash, result.userName, function () {
document.location.href = '/drive/';
});
});
return;
}
switch (err) {

@ -76,6 +76,8 @@ define([
if (result.proxy && !result.proxy.login_name) {
result.proxy.login_name = result.userName;
}
Cryptpad.whenRealtimeSyncs(result.realtime, function() {
Cryptpad.login(result.userHash, result.userName, function () {
if (sessionStorage.redirectTo) {
var h = sessionStorage.redirectTo;
@ -89,6 +91,7 @@ define([
}
window.location.href = '/drive/';
});
});
return;
}
switch (err) {

@ -42,7 +42,7 @@ define([
var obj = store.proxy;
var $div = $('<div>', {'class': 'infoBlock'});
var accountName = obj.login_name;
var accountName = obj.login_name || localStorage[Cryptpad.userNameKey];
var $label = $('<span>', {'class': 'label'}).text(Messages.user_accountName + ':');
var $name = $('<span>').text(accountName || '');
if (!accountName) {

Loading…
Cancel
Save