Fleet Sandbox: Login for sandbox redirects to sandbox's login url (#7220)

This commit is contained in:
RachelElysia 2022-08-15 16:29:57 -04:00 committed by GitHub
parent 78af071fce
commit 9f8ccd8113
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -0,0 +1 @@
* Sandbox redirects to sandbox login

View file

@ -28,6 +28,10 @@ export const AuthenticatedRoutes = ({
return router.push(LOGIN);
};
const redirectToSandboxLogin = () => {
return router.push("https://www.fleetdm.com/try-fleet/login");
};
const redirectToPasswordReset = () => {
const { RESET_PASSWORD } = paths;
@ -43,7 +47,12 @@ export const AuthenticatedRoutes = ({
useDeepEffect(() => {
// this works with App.tsx. if authToken does
// exist, user state is checked and fetched if null
if (!authToken()) {
if (window.location.pathname.includes("sandbox")) {
return redirectToSandboxLogin();
}
return redirectToLogin();
}