diff --git a/web/.cracorc.js b/web/.cracorc.js index 67c5744e0..f5cc481d8 100644 --- a/web/.cracorc.js +++ b/web/.cracorc.js @@ -1,5 +1,18 @@ +const isCoverage = process.env.COVERAGE === 'true' +const babelPlugins = isCoverage ? [ "babel-plugin-istanbul" ] : [] + module.exports = { babel: { - plugins: [ "babel-plugin-istanbul" ] - } -}; \ No newline at end of file + plugins: babelPlugins, + }, + plugins: [ + { + plugin: require("craco-alias"), + options: { + source: "tsconfig", + baseUrl: "./src", + tsConfigPath: "./tsconfig.aliases.json", + } + } + ] +}; diff --git a/web/package.json b/web/package.json index 2c95e45e2..edc7dfce9 100644 --- a/web/package.json +++ b/web/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "private": true, "dependencies": { - "@craco/craco": "6.1.2", "@fortawesome/fontawesome-svg-core": "1.2.35", "@fortawesome/free-regular-svg-icons": "5.15.3", "@fortawesome/free-solid-svg-icons": "5.15.3", @@ -46,10 +45,10 @@ }, "scripts": { "start": "craco start", - "build": "react-scripts build", + "build": "craco build", "lint": "eslint '*/**/*.{js,ts,tsx}' --fix", - "coverage": "craco build", - "test": "react-scripts test --coverage --no-cache", + "coverage": "COVERAGE=true craco build", + "test": "craco test --coverage --no-cache", "report": "nyc report -r clover -r json -r lcov -r text", "eject": "react-scripts eject" }, @@ -72,6 +71,8 @@ ] }, "devDependencies": { + "@craco/craco": "^6.1.2", + "craco-alias": "^3.0.1", "eslint-formatter-rdjson": "1.0.5" } } diff --git a/web/src/App.test.tsx b/web/src/App.test.tsx index 67a662c24..0af0bfe7e 100644 --- a/web/src/App.test.tsx +++ b/web/src/App.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { shallow } from "enzyme"; -import App from "./App"; +import App from "@root/App"; it("renders without crashing", () => { shallow(); diff --git a/web/src/App.tsx b/web/src/App.tsx index a672fa843..f7747df52 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -4,9 +4,7 @@ import { config as faConfig } from "@fortawesome/fontawesome-svg-core"; import { CssBaseline, ThemeProvider } from "@material-ui/core"; import { BrowserRouter as Router, Route, Switch, Redirect } from "react-router-dom"; -import NotificationBar from "./components/NotificationBar"; -import NotificationsContext from "./hooks/NotificationsContext"; -import { Notification } from "./models/Notifications"; +import NotificationBar from "@components/NotificationBar"; import { FirstFactorRoute, ResetPasswordStep2Route, @@ -15,17 +13,19 @@ import { RegisterOneTimePasswordRoute, LogoutRoute, ConsentRoute, -} from "./Routes"; -import * as themes from "./themes"; -import { getBasePath } from "./utils/BasePath"; -import { getRememberMe, getResetPassword, getTheme } from "./utils/Configuration"; -import RegisterOneTimePassword from "./views/DeviceRegistration/RegisterOneTimePassword"; -import RegisterSecurityKey from "./views/DeviceRegistration/RegisterSecurityKey"; -import ConsentView from "./views/LoginPortal/ConsentView/ConsentView"; -import LoginPortal from "./views/LoginPortal/LoginPortal"; -import SignOut from "./views/LoginPortal/SignOut/SignOut"; -import ResetPasswordStep1 from "./views/ResetPassword/ResetPasswordStep1"; -import ResetPasswordStep2 from "./views/ResetPassword/ResetPasswordStep2"; +} from "@constants/Routes"; +import NotificationsContext from "@hooks/NotificationsContext"; +import { Notification } from "@models/Notifications"; +import * as themes from "@themes/index"; +import { getBasePath } from "@utils/BasePath"; +import { getRememberMe, getResetPassword, getTheme } from "@utils/Configuration"; +import RegisterOneTimePassword from "@views/DeviceRegistration/RegisterOneTimePassword"; +import RegisterSecurityKey from "@views/DeviceRegistration/RegisterSecurityKey"; +import ConsentView from "@views/LoginPortal/ConsentView/ConsentView"; +import LoginPortal from "@views/LoginPortal/LoginPortal"; +import SignOut from "@views/LoginPortal/SignOut/SignOut"; +import ResetPasswordStep1 from "@views/ResetPassword/ResetPasswordStep1"; +import ResetPasswordStep2 from "@views/ResetPassword/ResetPasswordStep2"; import "@fortawesome/fontawesome-svg-core/styles.css"; diff --git a/web/src/components/AppStoreBadges.test.tsx b/web/src/components/AppStoreBadges.test.tsx index 54fa554d8..71c5dbd7a 100644 --- a/web/src/components/AppStoreBadges.test.tsx +++ b/web/src/components/AppStoreBadges.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import ReactDOM from "react-dom"; -import AppStoreBadges from "./AppStoreBadges"; +import AppStoreBadges from "@components/AppStoreBadges"; it("renders without crashing", () => { const div = document.createElement("div"); diff --git a/web/src/components/AppStoreBadges.tsx b/web/src/components/AppStoreBadges.tsx index 66417dc59..048c70680 100644 --- a/web/src/components/AppStoreBadges.tsx +++ b/web/src/components/AppStoreBadges.tsx @@ -2,8 +2,8 @@ import React from "react"; import { Link } from "@material-ui/core"; -import AppleStore from "../assets/images/applestore-badge.svg"; -import GooglePlay from "../assets/images/googleplay-badge.svg"; +import AppleStore from "@assets/images/applestore-badge.svg"; +import GooglePlay from "@assets/images/googleplay-badge.svg"; export interface Props { iconSize: number; diff --git a/web/src/components/ColoredSnackbarContent.test.tsx b/web/src/components/ColoredSnackbarContent.test.tsx index 3ffbe4e23..bf39739cf 100644 --- a/web/src/components/ColoredSnackbarContent.test.tsx +++ b/web/src/components/ColoredSnackbarContent.test.tsx @@ -5,7 +5,7 @@ import { expect } from "chai"; import { mount, shallow } from "enzyme"; import ReactDOM from "react-dom"; -import ColoredSnackbarContent from "./ColoredSnackbarContent"; +import ColoredSnackbarContent from "@components/ColoredSnackbarContent"; it("renders without crashing", () => { const div = document.createElement("div"); diff --git a/web/src/components/FailureIcon.test.tsx b/web/src/components/FailureIcon.test.tsx index e01698170..64ca3cf1a 100644 --- a/web/src/components/FailureIcon.test.tsx +++ b/web/src/components/FailureIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import FailureIcon from "./FailureIcon"; +import FailureIcon from "@components/FailureIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/FingerTouchIcon.test.tsx b/web/src/components/FingerTouchIcon.test.tsx index 31446e026..224d020be 100644 --- a/web/src/components/FingerTouchIcon.test.tsx +++ b/web/src/components/FingerTouchIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import FingerTouchIcon from "./FingerTouchIcon"; +import FingerTouchIcon from "@components/FingerTouchIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/FingerTouchIcon.tsx b/web/src/components/FingerTouchIcon.tsx index d7c9ad5aa..c4f2d0960 100644 --- a/web/src/components/FingerTouchIcon.tsx +++ b/web/src/components/FingerTouchIcon.tsx @@ -2,7 +2,7 @@ import React from "react"; import classnames from "classnames"; -import style from "./FingerTouchIcon.module.css"; +import style from "@components/FingerTouchIcon.module.css"; export interface Props { size: number; diff --git a/web/src/components/FixedTextField.test.tsx b/web/src/components/FixedTextField.test.tsx index af6b8a4ab..e9bd64ce2 100644 --- a/web/src/components/FixedTextField.test.tsx +++ b/web/src/components/FixedTextField.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import FixedTextField from "./FixedTextField"; +import FixedTextField from "@components/FixedTextField"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/InformationIcon.test.tsx b/web/src/components/InformationIcon.test.tsx index 8bd2ca559..166dacf66 100644 --- a/web/src/components/InformationIcon.test.tsx +++ b/web/src/components/InformationIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import InformationIcon from "./InformationIcon"; +import InformationIcon from "@components/InformationIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/LinearProgressBar.test.tsx b/web/src/components/LinearProgressBar.test.tsx index e436bc5bb..aacc57505 100644 --- a/web/src/components/LinearProgressBar.test.tsx +++ b/web/src/components/LinearProgressBar.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import LinearProgressBar from "./LinearProgressBar"; +import LinearProgressBar from "@components/LinearProgressBar"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/NotificationBar.test.tsx b/web/src/components/NotificationBar.test.tsx index 26fc81f44..8c8dae208 100644 --- a/web/src/components/NotificationBar.test.tsx +++ b/web/src/components/NotificationBar.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import NotificationBar from "./NotificationBar"; +import NotificationBar from "@components/NotificationBar"; it("renders without crashing", () => { mount( {}} />); diff --git a/web/src/components/NotificationBar.tsx b/web/src/components/NotificationBar.tsx index b58e2c90a..eec12db25 100644 --- a/web/src/components/NotificationBar.tsx +++ b/web/src/components/NotificationBar.tsx @@ -2,9 +2,9 @@ import React, { useState, useEffect } from "react"; import { Snackbar } from "@material-ui/core"; -import { useNotifications } from "../hooks/NotificationsContext"; -import { Notification } from "../models/Notifications"; -import ColoredSnackbarContent from "./ColoredSnackbarContent"; +import ColoredSnackbarContent from "@components/ColoredSnackbarContent"; +import { useNotifications } from "@hooks/NotificationsContext"; +import { Notification } from "@models/Notifications"; export interface Props { onClose: () => void; diff --git a/web/src/components/PieChartIcon.test.tsx b/web/src/components/PieChartIcon.test.tsx index 2a59a6c7c..5f863847a 100644 --- a/web/src/components/PieChartIcon.test.tsx +++ b/web/src/components/PieChartIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import PieChartIcon from "./PieChartIcon"; +import PieChartIcon from "@components/PieChartIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/PushNotificationIcon.test.tsx b/web/src/components/PushNotificationIcon.test.tsx index e11dad583..a842114b5 100644 --- a/web/src/components/PushNotificationIcon.test.tsx +++ b/web/src/components/PushNotificationIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import PushNotificationIcon from "./PushNotificationIcon"; +import PushNotificationIcon from "@components/PushNotificationIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/PushNotificationIcon.tsx b/web/src/components/PushNotificationIcon.tsx index 9842b7ec9..590bb1d0b 100644 --- a/web/src/components/PushNotificationIcon.tsx +++ b/web/src/components/PushNotificationIcon.tsx @@ -1,7 +1,7 @@ import React from "react"; -import { useIntermittentClass } from "../hooks/IntermittentClass"; -import style from "./PushNotificationIcon.module.css"; +import style from "@components/PushNotificationIcon.module.css"; +import { useIntermittentClass } from "@hooks/IntermittentClass"; export interface Props { width: number; diff --git a/web/src/components/SuccessIcon.test.tsx b/web/src/components/SuccessIcon.test.tsx index b7e460936..a5f2069c5 100644 --- a/web/src/components/SuccessIcon.test.tsx +++ b/web/src/components/SuccessIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import SuccessIcon from "./SuccessIcon"; +import SuccessIcon from "@components/SuccessIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/TimerIcon.test.tsx b/web/src/components/TimerIcon.test.tsx index 9c2a8a36d..8a6d426a0 100644 --- a/web/src/components/TimerIcon.test.tsx +++ b/web/src/components/TimerIcon.test.tsx @@ -2,7 +2,7 @@ import React from "react"; import { mount } from "enzyme"; -import TimerIcon from "./TimerIcon"; +import TimerIcon from "@components/TimerIcon"; it("renders without crashing", () => { mount(); diff --git a/web/src/components/TimerIcon.tsx b/web/src/components/TimerIcon.tsx index 48d3510e0..dec5548a4 100644 --- a/web/src/components/TimerIcon.tsx +++ b/web/src/components/TimerIcon.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from "react"; -import PieChartIcon from "./PieChartIcon"; +import PieChartIcon from "@components/PieChartIcon"; export interface Props { width: number; diff --git a/web/src/Routes.ts b/web/src/constants/Routes.ts similarity index 100% rename from web/src/Routes.ts rename to web/src/constants/Routes.ts diff --git a/web/src/constants.ts b/web/src/constants/constants.ts similarity index 100% rename from web/src/constants.ts rename to web/src/constants/constants.ts diff --git a/web/src/hooks/Configuration.ts b/web/src/hooks/Configuration.ts index bc3f6a3ec..97e7d6bad 100644 --- a/web/src/hooks/Configuration.ts +++ b/web/src/hooks/Configuration.ts @@ -1,5 +1,5 @@ -import { getConfiguration } from "../services/Configuration"; -import { useRemoteCall } from "./RemoteCall"; +import { useRemoteCall } from "@hooks/RemoteCall"; +import { getConfiguration } from "@services/Configuration"; export function useConfiguration() { return useRemoteCall(getConfiguration, []); diff --git a/web/src/hooks/Consent.ts b/web/src/hooks/Consent.ts index 9a7023b2f..4c7c7fed7 100644 --- a/web/src/hooks/Consent.ts +++ b/web/src/hooks/Consent.ts @@ -1,5 +1,5 @@ -import { getRequestedScopes } from "../services/Consent"; -import { useRemoteCall } from "./RemoteCall"; +import { useRemoteCall } from "@hooks/RemoteCall"; +import { getRequestedScopes } from "@services/Consent"; export function useRequestedScopes() { return useRemoteCall(getRequestedScopes, []); diff --git a/web/src/hooks/NotificationsContext.ts b/web/src/hooks/NotificationsContext.ts index 0cacc3c53..4a2d5ec50 100644 --- a/web/src/hooks/NotificationsContext.ts +++ b/web/src/hooks/NotificationsContext.ts @@ -1,7 +1,7 @@ import { useCallback, createContext, useContext } from "react"; -import { Level } from "../components/ColoredSnackbarContent"; -import { Notification } from "../models/Notifications"; +import { Level } from "@components/ColoredSnackbarContent"; +import { Notification } from "@models/Notifications"; const defaultOptions = { timeout: 5, diff --git a/web/src/hooks/State.ts b/web/src/hooks/State.ts index f3c16e8b9..7d30b0ca5 100644 --- a/web/src/hooks/State.ts +++ b/web/src/hooks/State.ts @@ -1,5 +1,5 @@ -import { getState } from "../services/State"; -import { useRemoteCall } from "./RemoteCall"; +import { useRemoteCall } from "@hooks/RemoteCall"; +import { getState } from "@services/State"; export function useAutheliaState() { return useRemoteCall(getState, []); diff --git a/web/src/hooks/UserInfo.ts b/web/src/hooks/UserInfo.ts index 96e34f443..b59ede4da 100644 --- a/web/src/hooks/UserInfo.ts +++ b/web/src/hooks/UserInfo.ts @@ -1,5 +1,5 @@ -import { getUserPreferences } from "../services/UserPreferences"; -import { useRemoteCall } from "./RemoteCall"; +import { useRemoteCall } from "@hooks/RemoteCall"; +import { getUserPreferences } from "@services/UserPreferences"; export function useUserPreferences() { return useRemoteCall(getUserPreferences, []); diff --git a/web/src/index.tsx b/web/src/index.tsx index c77f5cf35..04d408f30 100644 --- a/web/src/index.tsx +++ b/web/src/index.tsx @@ -1,12 +1,12 @@ -import "./utils/AssetPath"; +import "@utils/AssetPath"; import React from "react"; import ReactDOM from "react-dom"; -import "./index.css"; -import App from "./App"; -import * as serviceWorker from "./serviceWorker"; +import "@root/index.css"; +import App from "@root/App"; +import * as serviceWorker from "@root/serviceWorker"; ReactDOM.render(, document.getElementById("root")); diff --git a/web/src/layouts/LoginLayout.tsx b/web/src/layouts/LoginLayout.tsx index 81a6106dc..8d743a08e 100644 --- a/web/src/layouts/LoginLayout.tsx +++ b/web/src/layouts/LoginLayout.tsx @@ -3,7 +3,7 @@ import React, { ReactNode } from "react"; import { Grid, makeStyles, Container, Typography, Link } from "@material-ui/core"; import { grey } from "@material-ui/core/colors"; -import { ReactComponent as UserSvg } from "../assets/images/user.svg"; +import { ReactComponent as UserSvg } from "@assets/images/user.svg"; export interface Props { id?: string; diff --git a/web/src/models/Configuration.ts b/web/src/models/Configuration.ts index 01bd10ef0..fa0c27516 100644 --- a/web/src/models/Configuration.ts +++ b/web/src/models/Configuration.ts @@ -1,4 +1,4 @@ -import { SecondFactorMethod } from "./Methods"; +import { SecondFactorMethod } from "@models/Methods"; export interface Configuration { available_methods: Set; diff --git a/web/src/models/Notifications.ts b/web/src/models/Notifications.ts index 321a0c087..b97e1f1ff 100644 --- a/web/src/models/Notifications.ts +++ b/web/src/models/Notifications.ts @@ -1,4 +1,4 @@ -import { Level } from "../components/ColoredSnackbarContent"; +import { Level } from "@components/ColoredSnackbarContent"; export interface Notification { message: string; diff --git a/web/src/models/UserInfo.ts b/web/src/models/UserInfo.ts index ead0752d1..85059f540 100644 --- a/web/src/models/UserInfo.ts +++ b/web/src/models/UserInfo.ts @@ -1,4 +1,4 @@ -import { SecondFactorMethod } from "./Methods"; +import { SecondFactorMethod } from "@models/Methods"; export interface UserInfo { display_name: string; diff --git a/web/src/services/Api.ts b/web/src/services/Api.ts index a298723df..8c90d1666 100644 --- a/web/src/services/Api.ts +++ b/web/src/services/Api.ts @@ -1,6 +1,6 @@ import { AxiosResponse } from "axios"; -import { getBasePath } from "../utils/BasePath"; +import { getBasePath } from "@utils/BasePath"; const basePath = getBasePath(); diff --git a/web/src/services/Client.ts b/web/src/services/Client.ts index 3c65d9a18..d63459dd7 100644 --- a/web/src/services/Client.ts +++ b/web/src/services/Client.ts @@ -1,6 +1,6 @@ import axios from "axios"; -import { ServiceResponse, hasServiceError, toData } from "./Api"; +import { ServiceResponse, hasServiceError, toData } from "@services/Api"; export async function PostWithOptionalResponse(path: string, body?: any): Promise { const res = await axios.post>(path, body); diff --git a/web/src/services/Configuration.ts b/web/src/services/Configuration.ts index 0d6bcdd32..0bbb4349b 100644 --- a/web/src/services/Configuration.ts +++ b/web/src/services/Configuration.ts @@ -1,7 +1,7 @@ -import { Configuration } from "../models/Configuration"; -import { ConfigurationPath } from "./Api"; -import { Get } from "./Client"; -import { toEnum, Method2FA } from "./UserPreferences"; +import { Configuration } from "@models/Configuration"; +import { ConfigurationPath } from "@services/Api"; +import { Get } from "@services/Client"; +import { toEnum, Method2FA } from "@services/UserPreferences"; interface ConfigurationPayload { available_methods: Method2FA[]; diff --git a/web/src/services/Consent.ts b/web/src/services/Consent.ts index da38e11c7..e3a9e35af 100644 --- a/web/src/services/Consent.ts +++ b/web/src/services/Consent.ts @@ -1,5 +1,5 @@ -import { ConsentPath } from "./Api"; -import { Post, Get } from "./Client"; +import { ConsentPath } from "@services/Api"; +import { Post, Get } from "@services/Client"; interface ConsentPostRequestBody { client_id: string; diff --git a/web/src/services/FirstFactor.ts b/web/src/services/FirstFactor.ts index 708dd82cd..120e9d54f 100644 --- a/web/src/services/FirstFactor.ts +++ b/web/src/services/FirstFactor.ts @@ -1,6 +1,6 @@ -import { FirstFactorPath } from "./Api"; -import { PostWithOptionalResponse } from "./Client"; -import { SignInResponse } from "./SignIn"; +import { FirstFactorPath } from "@services/Api"; +import { PostWithOptionalResponse } from "@services/Client"; +import { SignInResponse } from "@services/SignIn"; interface PostFirstFactorBody { username: string; diff --git a/web/src/services/OneTimePassword.ts b/web/src/services/OneTimePassword.ts index 687a6a863..72707ded5 100644 --- a/web/src/services/OneTimePassword.ts +++ b/web/src/services/OneTimePassword.ts @@ -1,6 +1,6 @@ -import { CompleteTOTPSignInPath } from "./Api"; -import { PostWithOptionalResponse } from "./Client"; -import { SignInResponse } from "./SignIn"; +import { CompleteTOTPSignInPath } from "@services/Api"; +import { PostWithOptionalResponse } from "@services/Client"; +import { SignInResponse } from "@services/SignIn"; interface CompleteU2FSigninBody { token: string; diff --git a/web/src/services/PushNotification.ts b/web/src/services/PushNotification.ts index 66bfefca6..ec3db5b8a 100644 --- a/web/src/services/PushNotification.ts +++ b/web/src/services/PushNotification.ts @@ -1,6 +1,6 @@ -import { CompletePushNotificationSignInPath } from "./Api"; -import { PostWithOptionalResponse } from "./Client"; -import { SignInResponse } from "./SignIn"; +import { CompletePushNotificationSignInPath } from "@services/Api"; +import { PostWithOptionalResponse } from "@services/Client"; +import { SignInResponse } from "@services/SignIn"; interface CompleteU2FSigninBody { targetURL?: string; diff --git a/web/src/services/RegisterDevice.ts b/web/src/services/RegisterDevice.ts index ce4cb7614..82e9c9b2d 100644 --- a/web/src/services/RegisterDevice.ts +++ b/web/src/services/RegisterDevice.ts @@ -6,8 +6,8 @@ import { InitiateU2FRegistrationPath, CompleteU2FRegistrationStep1Path, CompleteU2FRegistrationStep2Path, -} from "./Api"; -import { Post, PostWithOptionalResponse } from "./Client"; +} from "@services/Api"; +import { Post, PostWithOptionalResponse } from "@services/Client"; export async function initiateTOTPRegistrationProcess() { await PostWithOptionalResponse(InitiateTOTPRegistrationPath); diff --git a/web/src/services/ResetPassword.ts b/web/src/services/ResetPassword.ts index 48612a892..02cdb9181 100644 --- a/web/src/services/ResetPassword.ts +++ b/web/src/services/ResetPassword.ts @@ -1,5 +1,5 @@ -import { InitiateResetPasswordPath, CompleteResetPasswordPath, ResetPasswordPath } from "./Api"; -import { PostWithOptionalResponse } from "./Client"; +import { InitiateResetPasswordPath, CompleteResetPasswordPath, ResetPasswordPath } from "@services/Api"; +import { PostWithOptionalResponse } from "@services/Client"; export async function initiateResetPasswordProcess(username: string) { return PostWithOptionalResponse(InitiateResetPasswordPath, { username }); diff --git a/web/src/services/SecurityKey.ts b/web/src/services/SecurityKey.ts index 7db823b5e..4cab3f1fb 100644 --- a/web/src/services/SecurityKey.ts +++ b/web/src/services/SecurityKey.ts @@ -1,8 +1,8 @@ import u2fApi from "u2f-api"; -import { InitiateU2FSignInPath, CompleteU2FSignInPath } from "./Api"; -import { Post, PostWithOptionalResponse } from "./Client"; -import { SignInResponse } from "./SignIn"; +import { InitiateU2FSignInPath, CompleteU2FSignInPath } from "@services/Api"; +import { Post, PostWithOptionalResponse } from "@services/Client"; +import { SignInResponse } from "@services/SignIn"; interface InitiateU2FSigninResponse { appId: string; diff --git a/web/src/services/SignOut.ts b/web/src/services/SignOut.ts index db5ea9711..bba444f50 100644 --- a/web/src/services/SignOut.ts +++ b/web/src/services/SignOut.ts @@ -1,5 +1,5 @@ -import { LogoutPath } from "./Api"; -import { PostWithOptionalResponse } from "./Client"; +import { LogoutPath } from "@services/Api"; +import { PostWithOptionalResponse } from "@services/Client"; export type SignOutResponse = { safeTargetURL: boolean } | undefined; diff --git a/web/src/services/State.ts b/web/src/services/State.ts index b653952e8..e603cb040 100644 --- a/web/src/services/State.ts +++ b/web/src/services/State.ts @@ -1,5 +1,5 @@ -import { StatePath } from "./Api"; -import { Get } from "./Client"; +import { StatePath } from "@services/Api"; +import { Get } from "@services/Client"; export enum AuthenticationLevel { Unauthenticated = 0, diff --git a/web/src/services/UserPreferences.ts b/web/src/services/UserPreferences.ts index 9fbb2a81d..683dce717 100644 --- a/web/src/services/UserPreferences.ts +++ b/web/src/services/UserPreferences.ts @@ -1,7 +1,7 @@ -import { SecondFactorMethod } from "../models/Methods"; -import { UserInfo } from "../models/UserInfo"; -import { UserInfoPath, UserInfo2FAMethodPath } from "./Api"; -import { Get, PostWithOptionalResponse } from "./Client"; +import { SecondFactorMethod } from "@models/Methods"; +import { UserInfo } from "@models/UserInfo"; +import { UserInfoPath, UserInfo2FAMethodPath } from "@services/Api"; +import { Get, PostWithOptionalResponse } from "@services/Client"; export type Method2FA = "u2f" | "totp" | "mobile_push"; diff --git a/web/src/themes/index.ts b/web/src/themes/index.ts index 0e2da1e69..808905c01 100644 --- a/web/src/themes/index.ts +++ b/web/src/themes/index.ts @@ -13,6 +13,6 @@ declare module "@material-ui/core/styles/createMuiTheme" { } } -export { default as Light } from "./Light"; -export { default as Dark } from "./Dark"; -export { default as Grey } from "./Grey"; +export { default as Light } from "@themes/Light"; +export { default as Dark } from "@themes/Dark"; +export { default as Grey } from "@themes/Grey"; diff --git a/web/src/utils/AssetPath.ts b/web/src/utils/AssetPath.ts index 8ff5e9f47..73fec7a84 100644 --- a/web/src/utils/AssetPath.ts +++ b/web/src/utils/AssetPath.ts @@ -1,4 +1,4 @@ -import { getBasePath } from "./BasePath"; +import { getBasePath } from "@utils/BasePath"; __webpack_public_path__ = "/"; diff --git a/web/src/utils/BasePath.ts b/web/src/utils/BasePath.ts index f09d231ef..ea2078d2f 100644 --- a/web/src/utils/BasePath.ts +++ b/web/src/utils/BasePath.ts @@ -1,4 +1,4 @@ -import { getEmbeddedVariable } from "./Configuration"; +import { getEmbeddedVariable } from "@utils/Configuration"; export function getBasePath() { return getEmbeddedVariable("basepath"); diff --git a/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx b/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx index 04101107d..31c47cd62 100644 --- a/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx +++ b/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx @@ -8,13 +8,13 @@ import classnames from "classnames"; import QRCode from "qrcode.react"; import { useHistory, useLocation } from "react-router"; -import AppStoreBadges from "../../components/AppStoreBadges"; -import { GoogleAuthenticator } from "../../constants"; -import { useNotifications } from "../../hooks/NotificationsContext"; -import LoginLayout from "../../layouts/LoginLayout"; -import { FirstFactorRoute } from "../../Routes"; -import { completeTOTPRegistrationProcess } from "../../services/RegisterDevice"; -import { extractIdentityToken } from "../../utils/IdentityToken"; +import AppStoreBadges from "@components/AppStoreBadges"; +import { GoogleAuthenticator } from "@constants/constants"; +import { FirstFactorRoute } from "@constants/Routes"; +import { useNotifications } from "@hooks/NotificationsContext"; +import LoginLayout from "@layouts/LoginLayout"; +import { completeTOTPRegistrationProcess } from "@services/RegisterDevice"; +import { extractIdentityToken } from "@utils/IdentityToken"; const RegisterOneTimePassword = function () { const style = useStyles(); diff --git a/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx b/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx index 11cbea3b4..1e1d7bb67 100644 --- a/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx +++ b/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx @@ -4,15 +4,12 @@ import { makeStyles, Typography, Button } from "@material-ui/core"; import { useHistory, useLocation } from "react-router"; import u2fApi from "u2f-api"; -import FingerTouchIcon from "../../components/FingerTouchIcon"; -import { useNotifications } from "../../hooks/NotificationsContext"; -import LoginLayout from "../../layouts/LoginLayout"; -import { FirstFactorPath } from "../../services/Api"; -import { - completeU2FRegistrationProcessStep1, - completeU2FRegistrationProcessStep2, -} from "../../services/RegisterDevice"; -import { extractIdentityToken } from "../../utils/IdentityToken"; +import FingerTouchIcon from "@components/FingerTouchIcon"; +import { useNotifications } from "@hooks/NotificationsContext"; +import LoginLayout from "@layouts/LoginLayout"; +import { FirstFactorPath } from "@services/Api"; +import { completeU2FRegistrationProcessStep1, completeU2FRegistrationProcessStep2 } from "@services/RegisterDevice"; +import { extractIdentityToken } from "@utils/IdentityToken"; const RegisterSecurityKey = function () { const style = useStyles(); diff --git a/web/src/views/LoginPortal/Authenticated.tsx b/web/src/views/LoginPortal/Authenticated.tsx index b7a246c48..1f99807bd 100644 --- a/web/src/views/LoginPortal/Authenticated.tsx +++ b/web/src/views/LoginPortal/Authenticated.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Typography, makeStyles } from "@material-ui/core"; -import SuccessIcon from "../../components/SuccessIcon"; +import SuccessIcon from "@components/SuccessIcon"; const Authenticated = function () { const classes = useStyles(); diff --git a/web/src/views/LoginPortal/AuthenticatedView/AuthenticatedView.tsx b/web/src/views/LoginPortal/AuthenticatedView/AuthenticatedView.tsx index 2c4a91bb4..a82885b95 100644 --- a/web/src/views/LoginPortal/AuthenticatedView/AuthenticatedView.tsx +++ b/web/src/views/LoginPortal/AuthenticatedView/AuthenticatedView.tsx @@ -3,9 +3,9 @@ import React from "react"; import { Grid, makeStyles, Button } from "@material-ui/core"; import { useHistory } from "react-router"; -import LoginLayout from "../../../layouts/LoginLayout"; -import { LogoutRoute as SignOutRoute } from "../../../Routes"; -import Authenticated from "../Authenticated"; +import { LogoutRoute as SignOutRoute } from "@constants/Routes"; +import LoginLayout from "@layouts/LoginLayout"; +import Authenticated from "@views/LoginPortal/Authenticated"; export interface Props { name: string; diff --git a/web/src/views/LoginPortal/ConsentView/ConsentView.tsx b/web/src/views/LoginPortal/ConsentView/ConsentView.tsx index 62437b259..0442a796c 100644 --- a/web/src/views/LoginPortal/ConsentView/ConsentView.tsx +++ b/web/src/views/LoginPortal/ConsentView/ConsentView.tsx @@ -4,12 +4,12 @@ import { Button, Grid, List, ListItem, ListItemIcon, ListItemText, Tooltip, make import { AccountBox, CheckBox, Contacts, Drafts, Group } from "@material-ui/icons"; import { useHistory } from "react-router-dom"; -import { useRequestedScopes } from "../../../hooks/Consent"; -import { useNotifications } from "../../../hooks/NotificationsContext"; -import { useRedirector } from "../../../hooks/Redirector"; -import LoginLayout from "../../../layouts/LoginLayout"; -import { acceptConsent, rejectConsent } from "../../../services/Consent"; -import LoadingPage from "../../LoadingPage/LoadingPage"; +import { useRequestedScopes } from "@hooks/Consent"; +import { useNotifications } from "@hooks/NotificationsContext"; +import { useRedirector } from "@hooks/Redirector"; +import LoginLayout from "@layouts/LoginLayout"; +import { acceptConsent, rejectConsent } from "@services/Consent"; +import LoadingPage from "@views/LoadingPage/LoadingPage"; export interface Props {} diff --git a/web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx b/web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx index 346310ac7..a9a34fc69 100644 --- a/web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx +++ b/web/src/views/LoginPortal/FirstFactor/FirstFactorForm.tsx @@ -4,13 +4,13 @@ import { makeStyles, Grid, Button, FormControlLabel, Checkbox, Link } from "@mat import classnames from "classnames"; import { useHistory } from "react-router"; -import FixedTextField from "../../../components/FixedTextField"; -import { useNotifications } from "../../../hooks/NotificationsContext"; -import { useRedirectionURL } from "../../../hooks/RedirectionURL"; -import { useRequestMethod } from "../../../hooks/RequestMethod"; -import LoginLayout from "../../../layouts/LoginLayout"; -import { ResetPasswordStep1Route } from "../../../Routes"; -import { postFirstFactor } from "../../../services/FirstFactor"; +import FixedTextField from "@components/FixedTextField"; +import { ResetPasswordStep1Route } from "@constants/Routes"; +import { useNotifications } from "@hooks/NotificationsContext"; +import { useRedirectionURL } from "@hooks/RedirectionURL"; +import { useRequestMethod } from "@hooks/RequestMethod"; +import LoginLayout from "@layouts/LoginLayout"; +import { postFirstFactor } from "@services/FirstFactor"; export interface Props { disabled: boolean; diff --git a/web/src/views/LoginPortal/LoginPortal.tsx b/web/src/views/LoginPortal/LoginPortal.tsx index a53cf8f22..a84d40746 100644 --- a/web/src/views/LoginPortal/LoginPortal.tsx +++ b/web/src/views/LoginPortal/LoginPortal.tsx @@ -2,14 +2,6 @@ import React, { useEffect, Fragment, ReactNode, useState, useCallback } from "re import { Switch, Route, Redirect, useHistory, useLocation } from "react-router"; -import { useConfiguration } from "../../hooks/Configuration"; -import { useNotifications } from "../../hooks/NotificationsContext"; -import { useRedirectionURL } from "../../hooks/RedirectionURL"; -import { useRedirector } from "../../hooks/Redirector"; -import { useRequestMethod } from "../../hooks/RequestMethod"; -import { useAutheliaState } from "../../hooks/State"; -import { useUserPreferences as userUserInfo } from "../../hooks/UserInfo"; -import { SecondFactorMethod } from "../../models/Methods"; import { FirstFactorRoute, SecondFactorRoute, @@ -17,12 +9,20 @@ import { SecondFactorPushRoute, SecondFactorU2FRoute, AuthenticatedRoute, -} from "../../Routes"; -import { AuthenticationLevel } from "../../services/State"; -import LoadingPage from "../LoadingPage/LoadingPage"; -import AuthenticatedView from "./AuthenticatedView/AuthenticatedView"; -import FirstFactorForm from "./FirstFactor/FirstFactorForm"; -import SecondFactorForm from "./SecondFactor/SecondFactorForm"; +} from "@constants/Routes"; +import { useConfiguration } from "@hooks/Configuration"; +import { useNotifications } from "@hooks/NotificationsContext"; +import { useRedirectionURL } from "@hooks/RedirectionURL"; +import { useRedirector } from "@hooks/Redirector"; +import { useRequestMethod } from "@hooks/RequestMethod"; +import { useAutheliaState } from "@hooks/State"; +import { useUserPreferences as userUserInfo } from "@hooks/UserInfo"; +import { SecondFactorMethod } from "@models/Methods"; +import { AuthenticationLevel } from "@services/State"; +import LoadingPage from "@views/LoadingPage/LoadingPage"; +import AuthenticatedView from "@views/LoginPortal/AuthenticatedView/AuthenticatedView"; +import FirstFactorForm from "@views/LoginPortal/FirstFactor/FirstFactorForm"; +import SecondFactorForm from "@views/LoginPortal/SecondFactor/SecondFactorForm"; export interface Props { rememberMe: boolean; diff --git a/web/src/views/LoginPortal/SecondFactor/MethodContainer.tsx b/web/src/views/LoginPortal/SecondFactor/MethodContainer.tsx index eb3db9264..e91cd0a6f 100644 --- a/web/src/views/LoginPortal/SecondFactor/MethodContainer.tsx +++ b/web/src/views/LoginPortal/SecondFactor/MethodContainer.tsx @@ -3,8 +3,8 @@ import React, { ReactNode, Fragment } from "react"; import { makeStyles, Typography, Link, useTheme } from "@material-ui/core"; import classnames from "classnames"; -import InformationIcon from "../../../components/InformationIcon"; -import Authenticated from "../Authenticated"; +import InformationIcon from "@components/InformationIcon"; +import Authenticated from "@views/LoginPortal/Authenticated"; export enum State { ALREADY_AUTHENTICATED = 1, diff --git a/web/src/views/LoginPortal/SecondFactor/MethodSelectionDialog.tsx b/web/src/views/LoginPortal/SecondFactor/MethodSelectionDialog.tsx index 172a2d276..9c82cc262 100644 --- a/web/src/views/LoginPortal/SecondFactor/MethodSelectionDialog.tsx +++ b/web/src/views/LoginPortal/SecondFactor/MethodSelectionDialog.tsx @@ -11,10 +11,10 @@ import { useTheme, } from "@material-ui/core"; -import FingerTouchIcon from "../../../components/FingerTouchIcon"; -import PushNotificationIcon from "../../../components/PushNotificationIcon"; -import TimerIcon from "../../../components/TimerIcon"; -import { SecondFactorMethod } from "../../../models/Methods"; +import FingerTouchIcon from "@components/FingerTouchIcon"; +import PushNotificationIcon from "@components/PushNotificationIcon"; +import TimerIcon from "@components/TimerIcon"; +import { SecondFactorMethod } from "@models/Methods"; export interface Props { open: boolean; diff --git a/web/src/views/LoginPortal/SecondFactor/OTPDial.tsx b/web/src/views/LoginPortal/SecondFactor/OTPDial.tsx index 923d41893..73c9d0e58 100644 --- a/web/src/views/LoginPortal/SecondFactor/OTPDial.tsx +++ b/web/src/views/LoginPortal/SecondFactor/OTPDial.tsx @@ -4,10 +4,10 @@ import { makeStyles } from "@material-ui/core"; import classnames from "classnames"; import OtpInput from "react-otp-input"; -import SuccessIcon from "../../../components/SuccessIcon"; -import TimerIcon from "../../../components/TimerIcon"; -import IconWithContext from "./IconWithContext"; -import { State } from "./OneTimePasswordMethod"; +import SuccessIcon from "@components/SuccessIcon"; +import TimerIcon from "@components/TimerIcon"; +import IconWithContext from "@views/LoginPortal/SecondFactor/IconWithContext"; +import { State } from "@views/LoginPortal/SecondFactor/OneTimePasswordMethod"; export interface Props { passcode: string; diff --git a/web/src/views/LoginPortal/SecondFactor/OneTimePasswordMethod.tsx b/web/src/views/LoginPortal/SecondFactor/OneTimePasswordMethod.tsx index 128d8800b..6a75d3876 100644 --- a/web/src/views/LoginPortal/SecondFactor/OneTimePasswordMethod.tsx +++ b/web/src/views/LoginPortal/SecondFactor/OneTimePasswordMethod.tsx @@ -1,10 +1,10 @@ import React, { useState, useEffect, useCallback } from "react"; -import { useRedirectionURL } from "../../../hooks/RedirectionURL"; -import { completeTOTPSignIn } from "../../../services/OneTimePassword"; -import { AuthenticationLevel } from "../../../services/State"; -import MethodContainer, { State as MethodContainerState } from "./MethodContainer"; -import OTPDial from "./OTPDial"; +import { useRedirectionURL } from "@hooks/RedirectionURL"; +import { completeTOTPSignIn } from "@services/OneTimePassword"; +import { AuthenticationLevel } from "@services/State"; +import MethodContainer, { State as MethodContainerState } from "@views/LoginPortal/SecondFactor/MethodContainer"; +import OTPDial from "@views/LoginPortal/SecondFactor/OTPDial"; export enum State { Idle = 1, diff --git a/web/src/views/LoginPortal/SecondFactor/PushNotificationMethod.tsx b/web/src/views/LoginPortal/SecondFactor/PushNotificationMethod.tsx index 14b7a4874..e4a789e2a 100644 --- a/web/src/views/LoginPortal/SecondFactor/PushNotificationMethod.tsx +++ b/web/src/views/LoginPortal/SecondFactor/PushNotificationMethod.tsx @@ -2,14 +2,14 @@ import React, { useEffect, useCallback, useState, ReactNode } from "react"; import { Button, makeStyles } from "@material-ui/core"; -import FailureIcon from "../../../components/FailureIcon"; -import PushNotificationIcon from "../../../components/PushNotificationIcon"; -import SuccessIcon from "../../../components/SuccessIcon"; -import { useIsMountedRef } from "../../../hooks/Mounted"; -import { useRedirectionURL } from "../../../hooks/RedirectionURL"; -import { completePushNotificationSignIn } from "../../../services/PushNotification"; -import { AuthenticationLevel } from "../../../services/State"; -import MethodContainer, { State as MethodContainerState } from "./MethodContainer"; +import FailureIcon from "@components/FailureIcon"; +import PushNotificationIcon from "@components/PushNotificationIcon"; +import SuccessIcon from "@components/SuccessIcon"; +import { useIsMountedRef } from "@hooks/Mounted"; +import { useRedirectionURL } from "@hooks/RedirectionURL"; +import { completePushNotificationSignIn } from "@services/PushNotification"; +import { AuthenticationLevel } from "@services/State"; +import MethodContainer, { State as MethodContainerState } from "@views/LoginPortal/SecondFactor/MethodContainer"; export enum State { SignInInProgress = 1, diff --git a/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx b/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx index 212a3dcc8..896395e4c 100644 --- a/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx +++ b/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx @@ -4,25 +4,25 @@ import { Grid, makeStyles, Button } from "@material-ui/core"; import { useHistory, Switch, Route, Redirect } from "react-router"; import u2fApi from "u2f-api"; -import { useNotifications } from "../../../hooks/NotificationsContext"; -import LoginLayout from "../../../layouts/LoginLayout"; -import { Configuration } from "../../../models/Configuration"; -import { SecondFactorMethod } from "../../../models/Methods"; -import { UserInfo } from "../../../models/UserInfo"; import { LogoutRoute as SignOutRoute, SecondFactorTOTPRoute, SecondFactorPushRoute, SecondFactorU2FRoute, SecondFactorRoute, -} from "../../../Routes"; -import { initiateTOTPRegistrationProcess, initiateU2FRegistrationProcess } from "../../../services/RegisterDevice"; -import { AuthenticationLevel } from "../../../services/State"; -import { setPreferred2FAMethod } from "../../../services/UserPreferences"; -import MethodSelectionDialog from "./MethodSelectionDialog"; -import OneTimePasswordMethod from "./OneTimePasswordMethod"; -import PushNotificationMethod from "./PushNotificationMethod"; -import SecurityKeyMethod from "./SecurityKeyMethod"; +} from "@constants/Routes"; +import { useNotifications } from "@hooks/NotificationsContext"; +import LoginLayout from "@layouts/LoginLayout"; +import { Configuration } from "@models/Configuration"; +import { SecondFactorMethod } from "@models/Methods"; +import { UserInfo } from "@models/UserInfo"; +import { initiateTOTPRegistrationProcess, initiateU2FRegistrationProcess } from "@services/RegisterDevice"; +import { AuthenticationLevel } from "@services/State"; +import { setPreferred2FAMethod } from "@services/UserPreferences"; +import MethodSelectionDialog from "@views/LoginPortal/SecondFactor/MethodSelectionDialog"; +import OneTimePasswordMethod from "@views/LoginPortal/SecondFactor/OneTimePasswordMethod"; +import PushNotificationMethod from "@views/LoginPortal/SecondFactor/PushNotificationMethod"; +import SecurityKeyMethod from "@views/LoginPortal/SecondFactor/SecurityKeyMethod"; const EMAIL_SENT_NOTIFICATION = "An email has been sent to your address to complete the process."; diff --git a/web/src/views/LoginPortal/SecondFactor/SecurityKeyMethod.tsx b/web/src/views/LoginPortal/SecondFactor/SecurityKeyMethod.tsx index 737abfea7..dad2284ec 100644 --- a/web/src/views/LoginPortal/SecondFactor/SecurityKeyMethod.tsx +++ b/web/src/views/LoginPortal/SecondFactor/SecurityKeyMethod.tsx @@ -4,16 +4,16 @@ import { makeStyles, Button, useTheme } from "@material-ui/core"; import { CSSProperties } from "@material-ui/styles"; import u2fApi from "u2f-api"; -import FailureIcon from "../../../components/FailureIcon"; -import FingerTouchIcon from "../../../components/FingerTouchIcon"; -import LinearProgressBar from "../../../components/LinearProgressBar"; -import { useIsMountedRef } from "../../../hooks/Mounted"; -import { useRedirectionURL } from "../../../hooks/RedirectionURL"; -import { useTimer } from "../../../hooks/Timer"; -import { initiateU2FSignin, completeU2FSignin } from "../../../services/SecurityKey"; -import { AuthenticationLevel } from "../../../services/State"; -import IconWithContext from "./IconWithContext"; -import MethodContainer, { State as MethodContainerState } from "./MethodContainer"; +import FailureIcon from "@components/FailureIcon"; +import FingerTouchIcon from "@components/FingerTouchIcon"; +import LinearProgressBar from "@components/LinearProgressBar"; +import { useIsMountedRef } from "@hooks/Mounted"; +import { useRedirectionURL } from "@hooks/RedirectionURL"; +import { useTimer } from "@hooks/Timer"; +import { initiateU2FSignin, completeU2FSignin } from "@services/SecurityKey"; +import { AuthenticationLevel } from "@services/State"; +import IconWithContext from "@views/LoginPortal/SecondFactor/IconWithContext"; +import MethodContainer, { State as MethodContainerState } from "@views/LoginPortal/SecondFactor/MethodContainer"; export enum State { WaitTouch = 1, diff --git a/web/src/views/LoginPortal/SignOut/SignOut.tsx b/web/src/views/LoginPortal/SignOut/SignOut.tsx index dd9e6b6b7..304adcd3d 100644 --- a/web/src/views/LoginPortal/SignOut/SignOut.tsx +++ b/web/src/views/LoginPortal/SignOut/SignOut.tsx @@ -3,13 +3,13 @@ import React, { useEffect, useCallback, useState } from "react"; import { Typography, makeStyles } from "@material-ui/core"; import { Redirect } from "react-router"; -import { useIsMountedRef } from "../../../hooks/Mounted"; -import { useNotifications } from "../../../hooks/NotificationsContext"; -import { useRedirectionURL } from "../../../hooks/RedirectionURL"; -import { useRedirector } from "../../../hooks/Redirector"; -import LoginLayout from "../../../layouts/LoginLayout"; -import { FirstFactorRoute } from "../../../Routes"; -import { signOut } from "../../../services/SignOut"; +import { FirstFactorRoute } from "@constants/Routes"; +import { useIsMountedRef } from "@hooks/Mounted"; +import { useNotifications } from "@hooks/NotificationsContext"; +import { useRedirectionURL } from "@hooks/RedirectionURL"; +import { useRedirector } from "@hooks/Redirector"; +import LoginLayout from "@layouts/LoginLayout"; +import { signOut } from "@services/SignOut"; export interface Props {} diff --git a/web/src/views/ResetPassword/ResetPasswordStep1.tsx b/web/src/views/ResetPassword/ResetPasswordStep1.tsx index 97e52f39e..8db00202f 100644 --- a/web/src/views/ResetPassword/ResetPasswordStep1.tsx +++ b/web/src/views/ResetPassword/ResetPasswordStep1.tsx @@ -3,11 +3,11 @@ import React, { useState } from "react"; import { Grid, Button, makeStyles } from "@material-ui/core"; import { useHistory } from "react-router"; -import FixedTextField from "../../components/FixedTextField"; -import { useNotifications } from "../../hooks/NotificationsContext"; -import LoginLayout from "../../layouts/LoginLayout"; -import { FirstFactorRoute } from "../../Routes"; -import { initiateResetPasswordProcess } from "../../services/ResetPassword"; +import FixedTextField from "@components/FixedTextField"; +import { FirstFactorRoute } from "@constants/Routes"; +import { useNotifications } from "@hooks/NotificationsContext"; +import LoginLayout from "@layouts/LoginLayout"; +import { initiateResetPasswordProcess } from "@services/ResetPassword"; const ResetPasswordStep1 = function () { const style = useStyles(); diff --git a/web/src/views/ResetPassword/ResetPasswordStep2.tsx b/web/src/views/ResetPassword/ResetPasswordStep2.tsx index af3dc5b7a..4bdc77064 100644 --- a/web/src/views/ResetPassword/ResetPasswordStep2.tsx +++ b/web/src/views/ResetPassword/ResetPasswordStep2.tsx @@ -4,12 +4,12 @@ import { Grid, Button, makeStyles } from "@material-ui/core"; import classnames from "classnames"; import { useHistory, useLocation } from "react-router"; -import FixedTextField from "../../components/FixedTextField"; -import { useNotifications } from "../../hooks/NotificationsContext"; -import LoginLayout from "../../layouts/LoginLayout"; -import { FirstFactorRoute } from "../../Routes"; -import { completeResetPasswordProcess, resetPassword } from "../../services/ResetPassword"; -import { extractIdentityToken } from "../../utils/IdentityToken"; +import FixedTextField from "@components/FixedTextField"; +import { FirstFactorRoute } from "@constants/Routes"; +import { useNotifications } from "@hooks/NotificationsContext"; +import LoginLayout from "@layouts/LoginLayout"; +import { completeResetPasswordProcess, resetPassword } from "@services/ResetPassword"; +import { extractIdentityToken } from "@utils/IdentityToken"; const ResetPasswordStep2 = function () { const style = useStyles(); diff --git a/web/tsconfig.aliases.json b/web/tsconfig.aliases.json new file mode 100644 index 000000000..bc8ca6525 --- /dev/null +++ b/web/tsconfig.aliases.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "baseUrl": "./src", + "jsx": "preserve", + "paths": { + "@root/*": ["./*"], + "@assets/*": ["assets/*"], + "@components/*": ["components/*"], + "@constants/*": ["constants/*"], + "@hooks/*": ["hooks/*"], + "@layouts/*": ["layouts/*"], + "@models/*": ["models/*"], + "@services/*": ["services/*"], + "@themes/*": ["themes/*"], + "@utils/*": ["utils/*"], + "@views/*": ["views/*"] + } + } +} \ No newline at end of file diff --git a/web/tsconfig.json b/web/tsconfig.json index 8c812cc5e..4d90f8418 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "./tsconfig.aliases.json", "compilerOptions": { "target": "es5", "lib": [ @@ -24,5 +25,10 @@ ".*.js", "src", "types" + ], + "exclude": [ + "node_modules", + "build", + "coverage" ] } diff --git a/web/yarn.lock b/web/yarn.lock index 1e09ca853..3106b705f 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -1876,7 +1876,7 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@craco/craco@6.1.2": +"@craco/craco@^6.1.2": version "6.1.2" resolved "https://registry.yarnpkg.com/@craco/craco/-/craco-6.1.2.tgz#30e45288e4609ac6b8cf828085b34acebdc60e69" integrity sha512-GlQZn+g+yNlaDvIL5m6mcCoBGyFDwO4kkNx3fNFf98wuldkdWyBFoQbtOFOIb4gvkTh4VntOOxtJEoZfKs7XXw== @@ -4563,6 +4563,11 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" +craco-alias@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/craco-alias/-/craco-alias-3.0.1.tgz#45e5cb338b222a7f62d17e398b54aff7cf1572af" + integrity sha512-N+Qaf/Gr/f3o5ZH2TQjMu5NhR9PnT1ZYsfejpNvZPpB0ujdrhsSr4Ct6GVjnV5ostCVquhTKJpIVBKyL9qDQYA== + create-ecdh@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff"