Skip to content

Commit

Permalink
Fix #955: don't display signed out message in tabs where user is alre…
Browse files Browse the repository at this point in the history
…ady signed out
  • Loading branch information
rafalp committed Feb 1, 2018
1 parent da396aa commit 8a3abf3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
9 changes: 7 additions & 2 deletions frontend/src/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Auth {
}

syncSession() {
let state = this._store.getState().auth;
const state = this._store.getState().auth;
if (state.isAuthenticated) {
this._local.set('auth', {
isAuthenticated: true,
Expand All @@ -28,12 +28,17 @@ export class Auth {
}

watchState() {
const state = this._store.getState().auth;
this._local.watch('auth', (newState) => {
if (newState.isAuthenticated) {
this._store.dispatch(signIn({
username: newState.username
}));
} else {
} else if (state.isAuthenticated) {
// check if we are authenticated in this tab
// because some browser plugins prune local store
// aggressively, forcing erroneous message to display here
// tracking bug #955
this._store.dispatch(signOut());
}
});
Expand Down

0 comments on commit 8a3abf3

Please sign in to comment.