From cbf153e45314bddf4458a5f8fc02462edc0d0595 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 16 Mar 2020 16:04:27 -0300 Subject: [PATCH] 16029: Fixes failed login attempt by redirecting the user to the login page. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/store/auth/auth-action.ts | 2 ++ src/views/main-panel/main-panel-root.tsx | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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) + ? + : ) + : } ); -- 2.30.2