Skip to content

Commit

Permalink
[dashboard] redirect anonymous users to www.
Browse files Browse the repository at this point in the history
in SaaS context we want to redirect not logged in users from the root URL with no additional context provided to the website URL.

fixes #3898
  • Loading branch information
AlexTugarev committed Apr 19, 2021
1 parent b92b12d commit 11338dd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Menu from './components/Menu';
import { BrowserRouter } from "react-router-dom";
import { Redirect, Route, Switch } from "react-router";

import { Login } from './Login';
import { Login, hasLoggedInBefore } from './Login';
import { UserContext } from './user-context';
import { getGitpodService } from './service/service';
import { shouldSeeWhatsNew, WhatsNew } from './WhatsNew';
Expand Down Expand Up @@ -71,6 +71,12 @@ function App() {
}
}, [localStorage.theme]);

if (window.location.pathname === '/' && window.location.hash === '' && !hasLoggedInBefore()) {
if (window.location.host === "gitpod.io" || window.location.host === "gitpod-staging.com") {
window.location.href = `https://www.${window.location.host}`;
}
}

if (loading) {
return <Loading />
}
Expand Down

0 comments on commit 11338dd

Please sign in to comment.