2020-06-21 13:40:37 +00:00
|
|
|
import React, { useState } from 'react';
|
2019-11-18 23:37:36 +00:00
|
|
|
import {
|
|
|
|
BrowserRouter as Router, Route, Switch, Redirect
|
|
|
|
} from "react-router-dom";
|
|
|
|
import ResetPasswordStep1 from './views/ResetPassword/ResetPasswordStep1';
|
|
|
|
import ResetPasswordStep2 from './views/ResetPassword/ResetPasswordStep2';
|
|
|
|
import RegisterSecurityKey from './views/DeviceRegistration/RegisterSecurityKey';
|
|
|
|
import RegisterOneTimePassword from './views/DeviceRegistration/RegisterOneTimePassword';
|
|
|
|
import {
|
|
|
|
FirstFactorRoute, ResetPasswordStep2Route,
|
|
|
|
ResetPasswordStep1Route, RegisterSecurityKeyRoute,
|
|
|
|
RegisterOneTimePasswordRoute,
|
|
|
|
LogoutRoute,
|
|
|
|
} from "./Routes";
|
|
|
|
import LoginPortal from './views/LoginPortal/LoginPortal';
|
|
|
|
import NotificationsContext from './hooks/NotificationsContext';
|
|
|
|
import { Notification } from './models/Notifications';
|
|
|
|
import NotificationBar from './components/NotificationBar';
|
|
|
|
import SignOut from './views/LoginPortal/SignOut/SignOut';
|
2020-07-01 07:16:08 +00:00
|
|
|
import { getRememberMe, getResetPassword } from './utils/Configuration';
|
2020-04-25 22:12:55 +00:00
|
|
|
import '@fortawesome/fontawesome-svg-core/styles.css'
|
2020-05-21 02:20:55 +00:00
|
|
|
import { config as faConfig } from '@fortawesome/fontawesome-svg-core';
|
2020-07-01 07:16:08 +00:00
|
|
|
import { getBasePath } from './utils/BasePath';
|
2020-04-25 22:12:55 +00:00
|
|
|
|
|
|
|
faConfig.autoAddCss = false;
|
2019-11-18 23:37:36 +00:00
|
|
|
|
|
|
|
const App: React.FC = () => {
|
|
|
|
const [notification, setNotification] = useState(null as Notification | null);
|
2019-12-07 16:40:42 +00:00
|
|
|
|
2019-11-18 23:37:36 +00:00
|
|
|
return (
|
|
|
|
<NotificationsContext.Provider value={{ notification, setNotification }} >
|
2020-07-01 07:16:08 +00:00
|
|
|
<Router basename={getBasePath()}>
|
2020-05-15 23:41:42 +00:00
|
|
|
<NotificationBar onClose={() => setNotification(null)} />
|
|
|
|
<Switch>
|
|
|
|
<Route path={ResetPasswordStep1Route} exact>
|
|
|
|
<ResetPasswordStep1 />
|
|
|
|
</Route>
|
|
|
|
<Route path={ResetPasswordStep2Route} exact>
|
|
|
|
<ResetPasswordStep2 />
|
|
|
|
</Route>
|
|
|
|
<Route path={RegisterSecurityKeyRoute} exact>
|
|
|
|
<RegisterSecurityKey />
|
|
|
|
</Route>
|
|
|
|
<Route path={RegisterOneTimePasswordRoute} exact>
|
|
|
|
<RegisterOneTimePassword />
|
|
|
|
</Route>
|
|
|
|
<Route path={LogoutRoute} exact>
|
|
|
|
<SignOut />
|
|
|
|
</Route>
|
|
|
|
<Route path={FirstFactorRoute}>
|
|
|
|
<LoginPortal
|
2020-07-01 07:16:08 +00:00
|
|
|
rememberMe={getRememberMe()}
|
|
|
|
resetPassword={getResetPassword()} />
|
2020-05-15 23:41:42 +00:00
|
|
|
</Route>
|
|
|
|
<Route path="/">
|
2020-05-21 02:20:55 +00:00
|
|
|
<Redirect to={FirstFactorRoute} />
|
2020-05-15 23:41:42 +00:00
|
|
|
</Route>
|
|
|
|
</Switch>
|
2019-11-18 23:37:36 +00:00
|
|
|
</Router>
|
|
|
|
</NotificationsContext.Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|