2019-12-16 08:49:10 +00:00
|
|
|
import React from "react";
|
2021-02-11 12:54:00 +00:00
|
|
|
import { Route, Switch, useLocation, useRouteMatch } from "react-router-dom";
|
2022-01-07 06:08:17 +00:00
|
|
|
import Login from "@appsmith/pages/UserAuth/Login";
|
|
|
|
|
import SignUp from "@appsmith/pages/UserAuth/SignUp";
|
2019-12-16 08:49:10 +00:00
|
|
|
import ForgotPassword from "./ForgotPassword";
|
|
|
|
|
import ResetPassword from "./ResetPassword";
|
2022-12-09 14:43:47 +00:00
|
|
|
import PageNotFound from "pages/common/ErrorPages/PageNotFound";
|
2020-09-24 16:05:18 +00:00
|
|
|
import * as Sentry from "@sentry/react";
|
2021-10-21 05:36:17 +00:00
|
|
|
import { requiresUnauth } from "./requiresAuthHOC";
|
2021-02-11 12:54:00 +00:00
|
|
|
import { useSelector } from "react-redux";
|
|
|
|
|
import { getThemeDetails, ThemeMode } from "selectors/themeSelectors";
|
2022-08-24 12:16:32 +00:00
|
|
|
import { AppState } from "@appsmith/reducers";
|
2021-02-11 12:54:00 +00:00
|
|
|
import { ThemeProvider } from "styled-components";
|
|
|
|
|
|
|
|
|
|
const SentryRoute = Sentry.withSentryRouting(Route);
|
2021-02-03 07:59:00 +00:00
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
export function UserAuth() {
|
2019-12-16 08:49:10 +00:00
|
|
|
const { path } = useRouteMatch();
|
|
|
|
|
const location = useLocation();
|
2021-10-04 15:34:37 +00:00
|
|
|
const lightTheme = useSelector((state: AppState) =>
|
|
|
|
|
getThemeDetails(state, ThemeMode.LIGHT),
|
2021-02-11 12:54:00 +00:00
|
|
|
);
|
2021-01-27 06:12:32 +00:00
|
|
|
|
|
|
|
|
return (
|
2021-10-04 15:34:37 +00:00
|
|
|
<ThemeProvider theme={lightTheme}>
|
2022-12-15 09:29:26 +00:00
|
|
|
<div className="absolute inset-0 flex flex-col overflow-y-auto auth-container bg-[color:var(--ads-color-background-secondary)] p-4 t--auth-container">
|
2022-12-09 14:43:47 +00:00
|
|
|
<Switch location={location}>
|
|
|
|
|
<SentryRoute component={Login} exact path={`${path}/login`} />
|
|
|
|
|
<SentryRoute component={SignUp} exact path={`${path}/signup`} />
|
|
|
|
|
<SentryRoute
|
|
|
|
|
component={ResetPassword}
|
|
|
|
|
exact
|
|
|
|
|
path={`${path}/resetPassword`}
|
|
|
|
|
/>
|
|
|
|
|
<SentryRoute
|
|
|
|
|
component={ForgotPassword}
|
|
|
|
|
exact
|
|
|
|
|
path={`${path}/forgotPassword`}
|
|
|
|
|
/>
|
|
|
|
|
<SentryRoute component={PageNotFound} />
|
|
|
|
|
</Switch>
|
|
|
|
|
</div>
|
2021-02-11 12:54:00 +00:00
|
|
|
</ThemeProvider>
|
2019-12-16 08:49:10 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2019-12-16 08:49:10 +00:00
|
|
|
|
2021-10-21 05:36:17 +00:00
|
|
|
export default requiresUnauth(UserAuth);
|