diff --git a/src/script/auth/page/Index.test.tsx b/src/script/auth/page/Index.test.tsx index 5dd352ff919..69c69c377a0 100644 --- a/src/script/auth/page/Index.test.tsx +++ b/src/script/auth/page/Index.test.tsx @@ -28,6 +28,7 @@ import {initialAuthState} from '../module/reducer/authReducer'; import {ROUTE} from '../route'; import {mockStoreFactory} from '../util/test/mockStoreFactory'; import {mountComponent} from '../util/test/TestUtil'; +import {getPrefixedSSOCode} from '../util/urlUtil'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -71,7 +72,7 @@ describe('when visiting the index page', () => { }), ); - expect(Navigate).toHaveBeenCalledWith({to: `${ROUTE.SSO}/wire-${defaultSSOCode}`}, {}); + expect(Navigate).toHaveBeenCalledWith({to: `${ROUTE.SSO}/${getPrefixedSSOCode(defaultSSOCode)}`}, {}); }); it('shows the welcome text with default backend name', () => { diff --git a/src/script/auth/page/Index.tsx b/src/script/auth/page/Index.tsx index 632cd431ce5..90c812f7ec7 100644 --- a/src/script/auth/page/Index.tsx +++ b/src/script/auth/page/Index.tsx @@ -40,6 +40,7 @@ import {bindActionCreators, RootState} from '../module/reducer'; import * as AuthSelector from '../module/selector/AuthSelector'; import {QUERY_KEY, ROUTE} from '../route'; import {logoutReasonStrings} from '../util/logoutUtil'; +import {getPrefixedSSOCode} from '../util/urlUtil'; type Props = React.HTMLProps; @@ -56,7 +57,7 @@ const IndexComponent = ({defaultSSOCode}: Props & ConnectedProps & DispatchProps if (defaultSSOCode) { // Redirect to prefilled SSO login if default SSO code is set on backend - return ; + return ; } const features = Config.getConfig().FEATURE; diff --git a/src/script/auth/page/Login.tsx b/src/script/auth/page/Login.tsx index 8ff3f3761f0..dd7a08b16c2 100644 --- a/src/script/auth/page/Login.tsx +++ b/src/script/auth/page/Login.tsx @@ -77,6 +77,7 @@ import * as ConversationSelector from '../module/selector/ConversationSelector'; import {QUERY_KEY, ROUTE} from '../route'; import {parseError, parseValidationErrors} from '../util/errorUtil'; import {getOAuthQueryString} from '../util/oauthUtil'; +import {getPrefixedSSOCode} from '../util/urlUtil'; type Props = React.HTMLProps & { embedded?: boolean; }; @@ -156,7 +157,7 @@ const LoginComponent = ({ useEffect(() => { // Redirect to prefilled SSO login if default SSO code is set on backend unless we're following the guest link flow if (defaultSSOCode && !embedded) { - navigate(`${ROUTE.SSO}/${defaultSSOCode}`); + navigate(`${ROUTE.SSO}/${getPrefixedSSOCode(defaultSSOCode)}`); } }, [defaultSSOCode, embedded, navigate]); @@ -474,7 +475,7 @@ const LoginComponent = ({