diff --git a/packages/developer-portal/src/components/pages/login/__tests__/login.test.tsx b/packages/developer-portal/src/components/pages/login/__tests__/login.test.tsx index 56cfa300d1..2dcfb9429a 100644 --- a/packages/developer-portal/src/components/pages/login/__tests__/login.test.tsx +++ b/packages/developer-portal/src/components/pages/login/__tests__/login.test.tsx @@ -59,8 +59,7 @@ describe('Login', () => { describe('onLoginButtonClick', () => { it('should run correctly', () => { const spyFn = jest.spyOn(reapitConnectBrowserSession, 'connectLoginRedirect') - const mockIsFirstTimeLogin = true - const fn = onLoginButtonClick(mockIsFirstTimeLogin) + const fn = onLoginButtonClick() fn() expect(spyFn).toBeCalled() }) diff --git a/packages/developer-portal/src/components/pages/login/login.tsx b/packages/developer-portal/src/components/pages/login/login.tsx index 6c3f279185..6aec39e1d9 100644 --- a/packages/developer-portal/src/components/pages/login/login.tsx +++ b/packages/developer-portal/src/components/pages/login/login.tsx @@ -7,7 +7,6 @@ import { Button, Level, FlexContainerBasic, Section } from '@reapit/elements' import { getDefaultRoute } from '@/utils/auth-route' import Routes from '@/constants/routes' import messages from '@/constants/messages' -import { getCookieString, COOKIE_DEVELOPER_FIRST_TIME_LOGIN_COMPLETE } from '@/utils/cookie' import loginStyles from '@/styles/pages/login.scss?mod' import logoImage from '@/assets/images/reapit-graphic.jpg' import connectImage from '@/assets/images/reapit-connect.png' @@ -30,10 +29,9 @@ export const handleShowNotificationAfterPasswordChanged = ( } } -export const onLoginButtonClick = (isFirtTimeLogin: boolean) => { +export const onLoginButtonClick = () => { return () => { - const redirectRoute = getDefaultRoute(isFirtTimeLogin) - reapitConnectBrowserSession.connectLoginRedirect(redirectRoute) + reapitConnectBrowserSession.connectLoginRedirect(getDefaultRoute(true)) } } @@ -41,7 +39,6 @@ export const Login: React.FunctionComponent = () => { const dispatch = useDispatch() const isPasswordChanged = localStorage.getItem('isPasswordChanged') === 'true' - const isFirtTimeLogin = Boolean(getCookieString(COOKIE_DEVELOPER_FIRST_TIME_LOGIN_COMPLETE)) React.useEffect(handleShowNotificationAfterPasswordChanged(isPasswordChanged, localStorage, dispatch), [ isPasswordChanged, @@ -59,12 +56,7 @@ export const Login: React.FunctionComponent = () => {

Welcome to Reapit Foundations

-
diff --git a/packages/developer-portal/src/core/private-route-wrapper.tsx b/packages/developer-portal/src/core/private-route-wrapper.tsx index 25ca4f75af..0b26928105 100644 --- a/packages/developer-portal/src/core/private-route-wrapper.tsx +++ b/packages/developer-portal/src/core/private-route-wrapper.tsx @@ -5,6 +5,7 @@ import { Redirect, useLocation } from 'react-router' import Routes from '@/constants/routes' import { useReapitConnect } from '@reapit/connect-session' import { reapitConnectBrowserSession } from '@/core/connect-session' +import { getCookieString, COOKIE_DEVELOPER_FIRST_TIME_LOGIN_COMPLETE } from '@/utils/cookie' const { Suspense } = React @@ -30,11 +31,16 @@ export const PrivateRouteWrapper: React.FunctionComponent + } + if ( (connectInternalRedirect && currentUri !== connectInternalRedirect) || (currentUri === connectInternalRedirect && isRoot)