refactor(web): use absolute imports with aliases (#2100)
* refactor(web): use absolute imports with aliases Refactors all of the TS/JS frontend to utilise absolute imports along with import aliases. Each of the paths within `src` are represented with their own alias: * @assets * @components * @constants (new) * @hooks * @layouts * @models * @services * @themes * @utils * @views `Routes.ts` and `constant.ts` have been relocated to the constants directory for consistency.pull/2102/head
parent
986f88fd89
commit
3494353641
|
@ -1,5 +1,18 @@
|
|||
const isCoverage = process.env.COVERAGE === 'true'
|
||||
const babelPlugins = isCoverage ? [ "babel-plugin-istanbul" ] : []
|
||||
|
||||
module.exports = {
|
||||
babel: {
|
||||
plugins: [ "babel-plugin-istanbul" ]
|
||||
}
|
||||
};
|
||||
plugins: babelPlugins,
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
plugin: require("craco-alias"),
|
||||
options: {
|
||||
source: "tsconfig",
|
||||
baseUrl: "./src",
|
||||
tsConfigPath: "./tsconfig.aliases.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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(<App />);
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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(<FailureIcon />);
|
||||
|
|
|
@ -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(<FingerTouchIcon size={32} />);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(<FixedTextField />);
|
||||
|
|
|
@ -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(<InformationIcon />);
|
||||
|
|
|
@ -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(<LinearProgressBar value={40} />);
|
||||
|
|
|
@ -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(<NotificationBar onClose={() => {}} />);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(<PieChartIcon progress={40} />);
|
||||
|
|
|
@ -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(<PushNotificationIcon width={32} height={32} />);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(<SuccessIcon />);
|
||||
|
|
|
@ -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(<TimerIcon width={32} height={32} />);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import PieChartIcon from "./PieChartIcon";
|
||||
import PieChartIcon from "@components/PieChartIcon";
|
||||
|
||||
export interface Props {
|
||||
width: number;
|
||||
|
|
|
@ -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, []);
|
||||
|
|
|
@ -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, []);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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, []);
|
||||
|
|
|
@ -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, []);
|
||||
|
|
|
@ -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(<App />, document.getElementById("root"));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SecondFactorMethod } from "./Methods";
|
||||
import { SecondFactorMethod } from "@models/Methods";
|
||||
|
||||
export interface Configuration {
|
||||
available_methods: Set<SecondFactorMethod>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Level } from "../components/ColoredSnackbarContent";
|
||||
import { Level } from "@components/ColoredSnackbarContent";
|
||||
|
||||
export interface Notification {
|
||||
message: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SecondFactorMethod } from "./Methods";
|
||||
import { SecondFactorMethod } from "@models/Methods";
|
||||
|
||||
export interface UserInfo {
|
||||
display_name: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { AxiosResponse } from "axios";
|
||||
|
||||
import { getBasePath } from "../utils/BasePath";
|
||||
import { getBasePath } from "@utils/BasePath";
|
||||
|
||||
const basePath = getBasePath();
|
||||
|
||||
|
|
|
@ -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<T = undefined>(path: string, body?: any): Promise<T | undefined> {
|
||||
const res = await axios.post<ServiceResponse<T>>(path, body);
|
||||
|
|
|
@ -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[];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getBasePath } from "./BasePath";
|
||||
import { getBasePath } from "@utils/BasePath";
|
||||
|
||||
__webpack_public_path__ = "/";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getEmbeddedVariable } from "./Configuration";
|
||||
import { getEmbeddedVariable } from "@utils/Configuration";
|
||||
|
||||
export function getBasePath() {
|
||||
return getEmbeddedVariable("basepath");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.";
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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/*"]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"extends": "./tsconfig.aliases.json",
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
|
@ -24,5 +25,10 @@
|
|||
".*.js",
|
||||
"src",
|
||||
"types"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"build",
|
||||
"coverage"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue