diff --git a/src/pages/authentication/AuthWrapper.jsx b/src/pages/authentication/AuthWrapper.jsx index 3b1ed4ca..38f68c64 100644 --- a/src/pages/authentication/AuthWrapper.jsx +++ b/src/pages/authentication/AuthWrapper.jsx @@ -4,10 +4,13 @@ import "./page-auth.css"; export const AuthWrapper = ({ children }) => { return (
+ {/*
{/*
+
*/}
*/}
+
{ {/*
*/} + {/*
*/} {children}
//
//
+ //
+ //
); }; \ No newline at end of file diff --git a/src/pages/authentication/ForgotPasswordPage.jsx b/src/pages/authentication/ForgotPasswordPage.jsx index 8a6fc608..8223cf32 100644 --- a/src/pages/authentication/ForgotPasswordPage.jsx +++ b/src/pages/authentication/ForgotPasswordPage.jsx @@ -1,5 +1,6 @@ import { useState } from "react"; import { Link } from "react-router-dom"; +import { Link } from "react-router-dom"; import { AuthWrapper } from "./AuthWrapper" import "./page-auth.css"; import AuthRepository from "../../repositories/AuthRepository"; @@ -7,16 +8,21 @@ import showToast from "../../services/toastService"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; +import { z } from "zod"; +const forgotPassSceham = z.object({ const forgotPassSceham = z.object({ email: z.string().email(), }) +}) const ForgotPasswordPage = () => { const [loding, setLoading] = useState(false) + const [loding, setLoading] = useState(false) + const { register, const { register, handleSubmit, formState: { errors }, @@ -27,15 +33,28 @@ const ForgotPasswordPage = () => { email: "" } }) + getValues } = useForm({ + resolver: zodResolver(forgotPassSceham), + defaultValues: { + email: "" + } + }) + const onSubmit = async (data) => { + try { const onSubmit = async (data) => { try { setLoading(true) const response = await AuthRepository.forgotPassword(data) + if (response.data && response.success) + showToast("verification email has been sent to your registered email address", "success") + const response = await AuthRepository.forgotPassword(data) if (response.data && response.success) showToast("verification email has been sent to your registered email address", "success") reset() setLoading(false) + } catch (err) { + setLoading(false) } catch (err) { reset() if (err.response.status === 404) { @@ -44,6 +63,12 @@ const ForgotPasswordPage = () => { showToast("Something wrong", "error") } + if (err.response.status === 404) { + showToast("verification email has been sent to your registered email address", "success") + } else { + showToast("Something wrong", "error") + } + setLoading(false) } } @@ -97,6 +122,11 @@ const ForgotPasswordPage = () => { + + {/* Footer Text */} + + + ); }; diff --git a/src/pages/authentication/LoginPage.jsx b/src/pages/authentication/LoginPage.jsx index 835895ae..7d1484dc 100644 --- a/src/pages/authentication/LoginPage.jsx +++ b/src/pages/authentication/LoginPage.jsx @@ -1,11 +1,13 @@ import { useEffect, useState } from "react"; import { Link, useNavigate } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import AuthRepository from "../../repositories/AuthRepository"; import showToast from "../../services/toastService"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { AuthWrapper } from "./AuthWrapper"; +import { AuthWrapper } from "./AuthWrapper"; const LoginPage = () => { const navigate = useNavigate(); @@ -18,11 +20,17 @@ const LoginPage = () => { ? z.object({ username: z.string().email({ message: "Valid email required" }), }) + username: z.string().email({ message: "Valid email required" }), + }) : z.object({ username: z.string().email({ message: "Valid email required" }), password: z.string().min(1, { message: "Password required" }), rememberMe: z.boolean(), }); + username: z.string().email({ message: "Valid email required" }), + password: z.string().min(1, { message: "Password required" }), + rememberMe: z.boolean(), + }); const { register, @@ -74,6 +82,7 @@ const LoginPage = () => { } }, [IsLoginWithOTP]); + return (
@@ -164,20 +173,52 @@ const LoginPage = () => {
)} + {/* Remember Me + Forgot Password */} +
+
+ + +
+ + Forgot Password? + +
+ + )} + {/* Submit */} {/* Submit */} + {/* Login With OTP Button */} + {/* Login With OTP Button */} {!IsLoginWithOTP && ( <> @@ -192,9 +233,40 @@ const LoginPage = () => { Login With OTP + <> +
+
or
+
+ + )} + + {/* Footer Text */} + {!IsLoginWithOTP ? ( +

+ New on our platform? + + Request a Demo + +

+ ) : ( +
+ +
{/* Footer Text */} {!IsLoginWithOTP ? (

@@ -216,6 +288,8 @@ const LoginPage = () => { )}

+ + ); }; diff --git a/src/pages/authentication/RegisterPage.jsx b/src/pages/authentication/RegisterPage.jsx index 6458248c..23a7497a 100644 --- a/src/pages/authentication/RegisterPage.jsx +++ b/src/pages/authentication/RegisterPage.jsx @@ -58,6 +58,7 @@ const RegisterPage = () => { fetchIndustries(); }, []); + useEffect(() => { }, [industries]); useEffect(() => { }, [industries]); const fetchIndustries = async () => { @@ -81,6 +82,7 @@ const RegisterPage = () => {
@@ -178,6 +180,7 @@ const RegisterPage = () => { +