From: Lucas Di Pentima Date: Mon, 16 Mar 2020 19:04:27 +0000 (-0300) Subject: 16029: Fixes failed login attempt by redirecting the user to the login page. X-Git-Tag: 2.1.0~32^2~11 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/cbf153e45314bddf4458a5f8fc02462edc0d0595 16029: Fixes failed login attempt by redirecting the user to the login page. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index 1d8a01c6..923d3c9e 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -78,6 +78,8 @@ export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: () setAuthorizationHeader(svc, token); return svc.authService.getUserDetails().then((user: User) => { dispatch(authActions.INIT_USER({ user, token })); + }).catch(() => { + dispatch(authActions.LOGOUT({ deleteLinkData: false })); }); }; diff --git a/src/views/main-panel/main-panel-root.tsx b/src/views/main-panel/main-panel-root.tsx index e7daaf00..5806f5b8 100644 --- a/src/views/main-panel/main-panel-root.tsx +++ b/src/views/main-panel/main-panel-root.tsx @@ -46,10 +46,16 @@ export const MainPanelRoot = withStyles(styles)( buildInfo={buildInfo} uuidPrefix={uuidPrefix} siteBanner={siteBanner}> - {working ? : null} + {working + ? + : null} } - {user ? (user.isActive || (!user.isActive && isLinkingPath) ? : ) : } + {user + ? (user.isActive || (!user.isActive && isLinkingPath) + ? + : ) + : } );