Skip to content

Commit b49985e

Browse files
fix: [UIE-9799] - Ensure browser history integrity when redirecting in IAM (#13190)
* ensure browser history integrity when redirecting in IAM * Added changeset: Ensure browser history integrity when redirecting in IAM
1 parent 91913c9 commit b49985e

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Ensure browser history integrity when redirecting in IAM ([#13190](https://github.com/linode/manager/pull/13190))

packages/manager/src/features/IAM/IAMLanding.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const IdentityAccessLanding = React.memo(() => {
5353
};
5454

5555
if (location.pathname === '/iam') {
56-
navigate({ to: '/iam/users' });
56+
navigate({ to: '/iam/users', replace: true });
5757
}
5858

5959
return (

packages/manager/src/routes/IAM/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const iamCatchAllRoute = createRoute({
3030
getParentRoute: () => iamRoute,
3131
path: '/$invalidPath',
3232
beforeLoad: () => {
33-
throw redirect({ to: '/iam/users' });
33+
throw redirect({ to: '/iam/users', replace: true });
3434
},
3535
});
3636

@@ -56,7 +56,7 @@ const iamUsersCatchAllRoute = createRoute({
5656
getParentRoute: () => iamUsersRoute,
5757
path: '/$invalidPath',
5858
beforeLoad: () => {
59-
throw redirect({ to: '/iam/users' });
59+
throw redirect({ to: '/iam/users', replace: true });
6060
},
6161
});
6262

@@ -73,6 +73,7 @@ const iamRolesRoute = createRoute({
7373
if (!isIAMEnabled) {
7474
throw redirect({
7575
to: '/account/users',
76+
replace: true,
7677
});
7778
}
7879
},
@@ -98,6 +99,7 @@ const iamDefaultsTabsRoute = createRoute({
9899
if (userType !== 'child' || !isDelegationEnabled) {
99100
throw redirect({
100101
to: '/iam/roles',
102+
replace: true,
101103
});
102104
}
103105
},
@@ -129,7 +131,7 @@ const iamRolesCatchAllRoute = createRoute({
129131
getParentRoute: () => iamRolesRoute,
130132
path: '/$invalidPath',
131133
beforeLoad: () => {
132-
throw redirect({ to: '/iam/roles' });
134+
throw redirect({ to: '/iam/roles', replace: true });
133135
},
134136
});
135137

@@ -144,6 +146,7 @@ const iamDelegationsRoute = createRoute({
144146
if (!isDelegationEnabled || isChildAccount) {
145147
throw redirect({
146148
to: '/iam/users',
149+
replace: true,
147150
});
148151
}
149152
},
@@ -157,7 +160,7 @@ const iamDelegationsCatchAllRoute = createRoute({
157160
getParentRoute: () => iamDelegationsRoute,
158161
path: '/$invalidPath',
159162
beforeLoad: () => {
160-
throw redirect({ to: '/iam/delegations' });
163+
throw redirect({ to: '/iam/delegations', replace: true });
161164
},
162165
});
163166

@@ -238,6 +241,7 @@ const iamUserNameIndexRoute = createRoute({
238241
throw redirect({
239242
to: '/iam/users/$username/details',
240243
params: { username: params.username },
244+
replace: true,
241245
});
242246
},
243247
}).lazy(() =>
@@ -260,6 +264,7 @@ const iamUserNameDetailsRoute = createRoute({
260264
throw redirect({
261265
to: '/account/users/$username/profile',
262266
params: { username },
267+
replace: true,
263268
});
264269
}
265270
},
@@ -309,6 +314,7 @@ const iamUserNameEntitiesRoute = createRoute({
309314
throw redirect({
310315
to: '/account/users/$username',
311316
params: { username },
317+
replace: true,
312318
});
313319
}
314320
},
@@ -331,6 +337,7 @@ const iamUserNameDelegationsRoute = createRoute({
331337
throw redirect({
332338
to: '/iam/users/$username/details',
333339
params: { username },
340+
replace: true,
334341
});
335342
}
336343
},
@@ -349,6 +356,7 @@ const iamUserNameCatchAllRoute = createRoute({
349356
throw redirect({
350357
to: '/iam/users/$username',
351358
params: { username: params.username },
359+
replace: true,
352360
});
353361
}
354362
},
@@ -361,6 +369,7 @@ const iamUserNameDetailsCatchAllRoute = createRoute({
361369
throw redirect({
362370
to: '/iam/users/$username/details',
363371
params: { username: params.username },
372+
replace: true,
364373
});
365374
},
366375
});
@@ -372,6 +381,7 @@ const iamUserNameRolesCatchAllRoute = createRoute({
372381
throw redirect({
373382
to: '/iam/users/$username/roles',
374383
params: { username: params.username },
384+
replace: true,
375385
});
376386
},
377387
});
@@ -383,6 +393,7 @@ const iamUserNameEntitiesCatchAllRoute = createRoute({
383393
throw redirect({
384394
to: '/iam/users/$username/entities',
385395
params: { username: params.username },
396+
replace: true,
386397
});
387398
},
388399
});

0 commit comments

Comments
 (0)