From 814837a4ca5cd609524720ba0e1cf5cb02bafdd4 Mon Sep 17 00:00:00 2001 From: AnveshNalimela Date: Wed, 1 Jan 2025 10:30:03 +0530 Subject: [PATCH] Closes ohcnetwork/#9456 --- src/Routers/SessionRouter.tsx | 2 + src/components/Auth/Authenicate.tsx | 250 ++++++++++++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 src/components/Auth/Authenicate.tsx diff --git a/src/Routers/SessionRouter.tsx b/src/Routers/SessionRouter.tsx index 86b4770288f..04794b16df4 100644 --- a/src/Routers/SessionRouter.tsx +++ b/src/Routers/SessionRouter.tsx @@ -1,6 +1,7 @@ import { useRoutes } from "raviger"; import { lazy } from "react"; +import { Authenticate } from "@/components/Auth/Authenicate"; import Login from "@/components/Auth/Login"; import ResetPassword from "@/components/Auth/ResetPassword"; import InvalidReset from "@/components/ErrorPages/InvalidReset"; @@ -68,6 +69,7 @@ export const routes = { ), "/login": () => , "/forgot-password": () => , + "/authenticate": () => , "/password_reset/:token": ({ token }: { token: string }) => ( ), diff --git a/src/components/Auth/Authenicate.tsx b/src/components/Auth/Authenicate.tsx new file mode 100644 index 00000000000..b10aa495dff --- /dev/null +++ b/src/components/Auth/Authenicate.tsx @@ -0,0 +1,250 @@ +import careConfig from "@careConfig"; +import { t } from "i18next"; +import { Link } from "raviger"; +import { useState } from "react"; + +import Card from "@/CAREUI/display/Card"; +import CareIcon from "@/CAREUI/icons/CareIcon"; + +import { Button } from "@/components/ui/button"; +import { CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; + +export const Authenticate = () => { + const { urls, stateLogo, customLogo, customLogoAlt } = careConfig; + const customDescriptionHtml = __CUSTOM_DESCRIPTION_HTML__; + const logos = [stateLogo, customLogo].filter( + (logo) => logo?.light || logo?.dark, + ); + const [recoveryModal, setRecoveryModal] = useState(false); + + const accesWays: string[] = ["Use a recovery code"]; + function handleRedirect(way: string): void { + if (way === "Use a recovery code") { + setRecoveryModal(true); + } + } + return ( +
+ {/* Hero Section */} +
+
+
+
+ {logos.map((logo, index) => + logo?.light ? ( +
+ state logo +
+ ) : null, + )} + {logos.length === 0 && ( + + Open Healthcare Network logo + + )} +
+
+

+ {t("care")} +

+ {customDescriptionHtml ? ( +
+
+
+ ) : ( +
+ {t("goal")} +
+ )} +
+
+
+
+
+ + Logo of Digital Public Goods Alliance + +
+ + Open Healthcare Network logo + +
+ + {t("footer_body")} + +
+ + {t("contribute_github")} + + | + + {t("third_party_software_licenses")} + +
+
+
+
+ {/* Login Forms Section */} +
+
+
+ {/* Logo for Mobile */} +
+ {logos.map((logo, index) => + logo?.dark ? ( +
+ state logo +
+ ) : null, + )} + {logos.length === 0 && ( + + Open Healthcare Network logo + + )} +
+ + + + Authenticate Your Account + + + + {!recoveryModal ? ( +
+ + + +

+ Dont share this verification code with anyone! +

+ +
+

+ Can't you access your code? +

+
    + {accesWays.map((way: string, idx: number) => ( +
  • handleRedirect(way)} + > + {way} +
  • + ))} +
+
+
+ ) : ( +
+ + + + +

+ Dont share this verification code with anyone! +

+
+ )} +
+
+
+
+
+
+ ); +};