critical bug: login stalls after refresh

This commit is contained in:
or-else
2020-02-27 19:54:32 +03:00
parent ffe2ab7737
commit 527a01bebb
5 changed files with 16 additions and 11 deletions
+7 -5
View File
@@ -353,7 +353,8 @@ class TinodeWeb extends React.Component {
loginDisabled: true, loginDisabled: true,
login: login, login: login,
password: password, password: password,
loadSpinnerVisible: true loadSpinnerVisible: true,
autoLogin: true
}); });
this.handleError('', null); this.handleError('', null);
@@ -362,7 +363,7 @@ class TinodeWeb extends React.Component {
} else { } else {
this.tinode.connect().catch((err) => { this.tinode.connect().catch((err) => {
// Socket error // Socket error
this.setState({loginDisabled: false}); this.setState({loginDisabled: false, autoLogin: false});
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
}); });
} }
@@ -443,7 +444,7 @@ class TinodeWeb extends React.Component {
cred = Tinode.credential(cred); cred = Tinode.credential(cred);
// Try to login with login/password. If they are not available, try token. If no token, ask for login/password. // Try to login with login/password. If they are not available, try token. If no token, ask for login/password.
let promise = null; let promise = null;
let token = this.tinode.getAuthToken(); const token = this.tinode.getAuthToken();
if (login && password) { if (login && password) {
this.setState({password: null}); this.setState({password: null});
promise = this.tinode.loginBasic(login, password, cred); promise = this.tinode.loginBasic(login, password, cred);
@@ -468,7 +469,8 @@ class TinodeWeb extends React.Component {
loginDisabled: false, loginDisabled: false,
credMethod: undefined, credMethod: undefined,
credCode: undefined, credCode: undefined,
loadSpinnerVisible: false loadSpinnerVisible: false,
autoLogin: false
}); });
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
localStorage.removeItem('auth-token'); localStorage.removeItem('auth-token');
@@ -593,7 +595,7 @@ class TinodeWeb extends React.Component {
// Merge search results and contact list to create a single flat // Merge search results and contact list to create a single flat
// list of kown contacts for GroupManager to use. // list of kown contacts for GroupManager to use.
static prepareSearchableContacts(chatList, foundContacts) { static prepareSearchableContacts(chatList, foundContacts) {
let merged = {}; const merged = {};
// For chatList topics merge only p2p topics and convert them to the // For chatList topics merge only p2p topics and convert them to the
// same format as foundContacts. // same format as foundContacts.
+6 -3
View File
@@ -4965,7 +4965,8 @@ var TinodeWeb = function (_React$Component) {
loginDisabled: true, loginDisabled: true,
login: login, login: login,
password: password, password: password,
loadSpinnerVisible: true loadSpinnerVisible: true,
autoLogin: true
}); });
this.handleError('', null); this.handleError('', null);
@@ -4977,7 +4978,8 @@ var TinodeWeb = function (_React$Component) {
} else { } else {
this.tinode.connect().catch(function (err) { this.tinode.connect().catch(function (err) {
_this4.setState({ _this4.setState({
loginDisabled: false loginDisabled: false,
autoLogin: false
}); });
_this4.handleError(err.message, 'err'); _this4.handleError(err.message, 'err');
@@ -5094,7 +5096,8 @@ var TinodeWeb = function (_React$Component) {
loginDisabled: false, loginDisabled: false,
credMethod: undefined, credMethod: undefined,
credCode: undefined, credCode: undefined,
loadSpinnerVisible: false loadSpinnerVisible: false,
autoLogin: false
}); });
_this6.handleError(err.message, 'err'); _this6.handleError(err.message, 'err');
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long