Skip to content

Commit ac332ab

Browse files
Remove login routes when federated (#1697)
<!-- Ensure the title clearly reflects what was changed. Provide a clear and concise description of the changes made. The PR should only contain the changes related to the issue, and no other unrelated changes. --> Fixes OPS-3163
1 parent f6ea2e6 commit ac332ab

1 file changed

Lines changed: 69 additions & 55 deletions

File tree

packages/react-ui/src/app/router.tsx

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ const createRoutes = () => {
6565
FlagId.SHOW_DEMO_HOME_PAGE,
6666
);
6767

68+
const { data: isFederatedLogin } = flagsHooks.useFlag<boolean | undefined>(
69+
FlagId.FEDERATED_LOGIN_ENABLED,
70+
);
71+
6872
const routes = [
6973
{
7074
path: 'flows',
@@ -140,61 +144,6 @@ const createRoutes = () => {
140144
),
141145
errorElement: <RouteErrorBoundary />,
142146
},
143-
{
144-
path: 'forget-password',
145-
element: (
146-
<OpsErrorBoundary>
147-
<PageTitle title="Forget Password">
148-
<ResetPasswordPage />
149-
</PageTitle>
150-
</OpsErrorBoundary>
151-
),
152-
errorElement: <RouteErrorBoundary />,
153-
},
154-
{
155-
path: 'reset-password',
156-
element: (
157-
<OpsErrorBoundary>
158-
<PageTitle title="Reset Password">
159-
<ChangePasswordPage />
160-
</PageTitle>
161-
</OpsErrorBoundary>
162-
),
163-
errorElement: <RouteErrorBoundary />,
164-
},
165-
{
166-
path: 'sign-in',
167-
element: (
168-
<OpsErrorBoundary>
169-
<PageTitle title="Sign In">
170-
<SignInPage />
171-
</PageTitle>
172-
</OpsErrorBoundary>
173-
),
174-
errorElement: <RouteErrorBoundary />,
175-
},
176-
{
177-
path: 'verify-email',
178-
element: (
179-
<OpsErrorBoundary>
180-
<PageTitle title="Verify Email">
181-
<VerifyEmail />
182-
</PageTitle>
183-
</OpsErrorBoundary>
184-
),
185-
errorElement: <RouteErrorBoundary />,
186-
},
187-
{
188-
path: 'sign-up',
189-
element: (
190-
<OpsErrorBoundary>
191-
<PageTitle title="Sign Up">
192-
<SignUpPage />
193-
</PageTitle>
194-
</OpsErrorBoundary>
195-
),
196-
errorElement: <RouteErrorBoundary />,
197-
},
198147
{
199148
path: 'settings/appearance',
200149
element: (
@@ -278,6 +227,70 @@ const createRoutes = () => {
278227
),
279228
errorElement: <RouteErrorBoundary />,
280229
},
230+
];
231+
232+
if (!isFederatedLogin) {
233+
const regularLoginRoutes = [
234+
{
235+
path: 'forget-password',
236+
element: (
237+
<OpsErrorBoundary>
238+
<PageTitle title="Forget Password">
239+
<ResetPasswordPage />
240+
</PageTitle>
241+
</OpsErrorBoundary>
242+
),
243+
errorElement: <RouteErrorBoundary />,
244+
},
245+
{
246+
path: 'reset-password',
247+
element: (
248+
<OpsErrorBoundary>
249+
<PageTitle title="Reset Password">
250+
<ChangePasswordPage />
251+
</PageTitle>
252+
</OpsErrorBoundary>
253+
),
254+
errorElement: <RouteErrorBoundary />,
255+
},
256+
{
257+
path: 'sign-in',
258+
element: (
259+
<OpsErrorBoundary>
260+
<PageTitle title="Sign In">
261+
<SignInPage />
262+
</PageTitle>
263+
</OpsErrorBoundary>
264+
),
265+
errorElement: <RouteErrorBoundary />,
266+
},
267+
{
268+
path: 'verify-email',
269+
element: (
270+
<OpsErrorBoundary>
271+
<PageTitle title="Verify Email">
272+
<VerifyEmail />
273+
</PageTitle>
274+
</OpsErrorBoundary>
275+
),
276+
errorElement: <RouteErrorBoundary />,
277+
},
278+
{
279+
path: 'sign-up',
280+
element: (
281+
<OpsErrorBoundary>
282+
<PageTitle title="Sign Up">
283+
<SignUpPage />
284+
</PageTitle>
285+
</OpsErrorBoundary>
286+
),
287+
errorElement: <RouteErrorBoundary />,
288+
},
289+
];
290+
routes.push(...regularLoginRoutes);
291+
}
292+
293+
const redirectRoutes = [
281294
{
282295
path: 'redirect',
283296
element: <RedirectPage></RedirectPage>,
@@ -295,6 +308,7 @@ const createRoutes = () => {
295308
errorElement: <RouteErrorBoundary />,
296309
},
297310
];
311+
routes.push(...redirectRoutes);
298312

299313
if (isCloudConnectionPageEnabled) {
300314
const CloudConnectionPage = lazy(

0 commit comments

Comments
 (0)