1 Commits

Author SHA1 Message Date
Ebube 49c639e8e2 added auth-screen image and added correct links 2024-02-17 15:42:18 +01:00
7 changed files with 26 additions and 82 deletions
+1 -4
View File
@@ -14,7 +14,4 @@ VITE_APP_PREVIEW_DOCS_URL=https://www.wrenchboard.com/
VITE_APP_THEME_API_URL=https://api.wrenchboard/api/api
# main url
VITE_APP_MAINSITE_URL=https://www.wrenchboard.com
VITE_APP_SESSION_EXPIRE_CHECKER=60000
VITE_APP_SESSION_EXPIRE_MINUTES=900000
VITE_APP_WRENCH_IDENTITY_SITE=https://dev-ident.wrenchboard.com/
VITE_APP_MAINSITE_URL=https://www.wrenchboard.com
+1 -7
View File
@@ -11,10 +11,4 @@ VITE_APP_PURCHASE_URL=https://themeforest.net/item/metronic-responsive-admin-das
VITE_APP_PREVIEW_URL=https://preview.keenthemes.com/metronic8/react/demo1/
VITE_APP_PREVIEW_REACT_URL=https://preview.keenthemes.com/metronic8/react
VITE_APP_PREVIEW_DOCS_URL=https://preview.keenthemes.com/metronic8/react/docs
VITE_APP_THEME_API_URL=https://preview.keenthemes.com/theme-api/api
# main url
VITE_APP_MAINSITE_URL=https://www.wrenchboard.com
VITE_APP_SESSION_EXPIRE_CHECKER=60000
VITE_APP_SESSION_EXPIRE_MINUTES=900000
VITE_APP_WRENCH_IDENTITY_SITE=https://dev-ident.wrenchboard.com/
VITE_APP_THEME_API_URL=https://preview.keenthemes.com/theme-api/api
+1 -7
View File
@@ -11,10 +11,4 @@ VITE_APP_PURCHASE_URL=https://themeforest.net/item/metronic-responsive-admin-das
VITE_APP_PREVIEW_URL=https://preview.keenthemes.com/metronic8/react/demo1/
VITE_APP_PREVIEW_REACT_URL=https://preview.keenthemes.com/metronic8/react
VITE_APP_PREVIEW_DOCS_URL=https://preview.keenthemes.com/metronic8/react/docs
VITE_APP_THEME_API_URL=https://preview.keenthemes.com/theme-api/api
# main url
VITE_APP_MAINSITE_URL=https://www.wrenchboard.com
VITE_APP_SESSION_EXPIRE_CHECKER=60000
VITE_APP_SESSION_EXPIRE_MINUTES=900000
VITE_APP_WRENCH_IDENTITY_SITE=https://dev-ident.wrenchboard.com/
VITE_APP_THEME_API_URL=https://preview.keenthemes.com/theme-api/api
+5 -1
View File
@@ -2,6 +2,10 @@ import { useEffect } from "react";
import { Outlet, Link } from "react-router-dom";
import { toAbsoluteUrl } from "../../../_metronic/helpers";
interface EnvironmentVariables {
VITE_APP_MAINSITE_URL: string;
}
const AuthLayout = () => {
useEffect(() => {
const root = document.getElementById("root");
@@ -80,7 +84,7 @@ const AuthLayout = () => {
<img
className="mx-auto w-275px w-md-50 w-xl-500px mb-10 mb-lg-20"
src={toAbsoluteUrl("media/misc/agents-auth-screens.png")}
alt="WrenchBoard-start-img"
alt="wrenchboard-start-img"
/>
{/* end::Image */}
+17 -16
View File
@@ -7,8 +7,6 @@ import { getUserByToken, login } from "../core/_requests";
import { toAbsoluteUrl } from "../../../../_metronic/helpers";
import { useAuth } from "../core/Auth";
const SOCIAL_LINK = import.meta.env.VITE_APP_WRENCH_IDENTITY_SITE;
const loginSchema = Yup.object().shape({
email: Yup.string()
.email("Wrong email format")
@@ -27,7 +25,7 @@ const initialValues = {
};
// email: "admin@demo.com",
// password: "demo",
// password: "demo",
/*
Formik+YUP+Typescript:
https://jaredpalmer.com/formik/docs/tutorial#getfieldprops
@@ -77,9 +75,7 @@ export function Login() {
<div className="col-md-6">
{/* begin::Google link */}
<a
href={SOCIAL_LINK}
target="_blank"
rel="noopener noreferrer"
href="#"
className="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100"
>
<img
@@ -97,17 +93,20 @@ export function Login() {
<div className="col-md-6">
{/* begin::Google link */}
<a
href={SOCIAL_LINK}
target="_blank"
rel="noopener noreferrer"
href="#"
className="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100"
>
<img
alt="Logo"
src={toAbsoluteUrl("media/svg/brand-logos/facebook-4.svg")}
className="h-15px me-3"
src={toAbsoluteUrl("media/svg/brand-logos/apple-black.svg")}
className="theme-light-show h-15px me-3"
/>
Sign in with Facebook
<img
alt="Logo"
src={toAbsoluteUrl("media/svg/brand-logos/apple-black-dark.svg")}
className="theme-dark-show h-15px me-3"
/>
Sign in with Apple
</a>
{/* end::Google link */}
</div>
@@ -127,11 +126,13 @@ export function Login() {
<div className="mb-lg-15 alert alert-danger">
<div className="alert-text font-weight-bold">{formik.status}</div>
</div>
) : // <div className="mb-10 bg-light-info p-8 rounded">
) : (
// <div className="mb-10 bg-light-info p-8 rounded">
// </div>
// </div>
null}
null
)}
{/* begin::Form group */}
<div className="fv-row mb-8">
-46
View File
@@ -3,7 +3,6 @@ import {
FC,
useState,
useEffect,
useCallback,
createContext,
useContext,
Dispatch,
@@ -40,15 +39,6 @@ const useAuth = () => {
const AuthProvider: FC<WithChildren> = ({ children }) => {
const [auth, setAuth] = useState<AuthModel | undefined>(authHelper.getAuth());
const [currentUser, setCurrentUser] = useState<UserModel | undefined>();
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
let checkExpirationInMinutes: number = Number(
import.meta.env.VITE_APP_SESSION_EXPIRE_MINUTES
);
let expirationChecker: number = Number(
import.meta.env.VITE_APP_SESSION_EXPIRE_CHECKER
);
const saveAuth = (auth: AuthModel | undefined) => {
setAuth(auth);
if (auth) {
@@ -63,42 +53,6 @@ const AuthProvider: FC<WithChildren> = ({ children }) => {
setCurrentUser(undefined);
};
useEffect((): any => {
const expireSession = () => {
localStorage.removeItem("wrenchboard-agent-auth-details");
logout();
};
const checkInactivity = setInterval(() => {
let currentTime: number = Date.now();
let checkLastActivityTime: number = lastActivityTime;
if (currentTime - checkLastActivityTime > checkExpirationInMinutes) {
expireSession();
}
}, expirationChecker);
// cleaning up listeners
return () => {
clearInterval(checkInactivity);
};
}, [lastActivityTime]);
// Reset last activity time on user input
const resetTime = useCallback(() => {
setLastActivityTime(Date.now());
}, []);
useEffect(() => {
window.addEventListener("mousemove", resetTime);
window.addEventListener("keydown", resetTime);
return () => {
window.removeEventListener("mousemove", resetTime);
window.removeEventListener("keydown", resetTime);
};
}, [resetTime]);
return (
<AuthContext.Provider
value={{ auth, saveAuth, currentUser, setCurrentUser, logout }}
+1 -1
View File
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {AuthModel} from './_models'
const AUTH_LOCAL_STORAGE_KEY = 'wrenchboard-agent-auth-details'
const AUTH_LOCAL_STORAGE_KEY = 'kt-auth-react-v'
const getAuth = (): AuthModel | undefined => {
if (!localStorage) {
return