mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixing session and logout errors
This commit is contained in:
@@ -27,7 +27,9 @@ export default class Login extends React.Component {
|
||||
this.preSubmit = this.preSubmit.bind(this);
|
||||
this.submit = this.submit.bind(this);
|
||||
|
||||
this.state = this.getStateFromStores();
|
||||
const state = this.getStateFromStores();
|
||||
state.doneCheckLogin = false;
|
||||
this.state = state;
|
||||
}
|
||||
componentDidMount() {
|
||||
TeamStore.addChangeListener(this.onTeamChange);
|
||||
@@ -44,8 +46,7 @@ export default class Login extends React.Component {
|
||||
}
|
||||
getStateFromStores() {
|
||||
return {
|
||||
currentTeam: TeamStore.getByName(this.props.params.team),
|
||||
doneCheckLogin: false
|
||||
currentTeam: TeamStore.getByName(this.props.params.team)
|
||||
};
|
||||
}
|
||||
onTeamChange() {
|
||||
|
||||
@@ -142,6 +142,8 @@ function preLoggedIn(nextState, replace, callback) {
|
||||
|
||||
const d2 = AsyncClient.getChannels();
|
||||
|
||||
ErrorStore.clearLastError();
|
||||
|
||||
$.when(d1, d2).done(() => {
|
||||
callback();
|
||||
});
|
||||
|
||||
@@ -59,6 +59,7 @@ class ErrorStoreClass extends EventEmitter {
|
||||
clearLastError() {
|
||||
BrowserStore.removeGlobalItem('last_error');
|
||||
BrowserStore.removeGlobalItem('last_error_conn');
|
||||
this.emitChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,8 @@ function handleError(methodName, xhr, status, err) {
|
||||
track('api', 'api_weberror', methodName, 'message', msg);
|
||||
|
||||
if (xhr.status === 401) {
|
||||
if (window.location.href.indexOf('/channels') === 0) {
|
||||
browserHistory.push('/login?extra=expired&redirect=' + encodeURIComponent(window.location.pathname + window.location.search));
|
||||
} else {
|
||||
var teamURL = window.location.pathname.split('/channels')[0];
|
||||
browserHistory.push(teamURL + '/login?extra=expired&redirect=' + encodeURIComponent(window.location.pathname + window.location.search));
|
||||
}
|
||||
const team = window.location.pathname.split('/')[1];
|
||||
browserHistory.push('/' + team + '/login?extra=expired&redirect=' + encodeURIComponent(window.location.pathname + window.location.search));
|
||||
}
|
||||
|
||||
return e;
|
||||
|
||||
Reference in New Issue
Block a user