diff --git a/src/pages/authentication/AuthWrapper.jsx b/src/pages/authentication/AuthWrapper.jsx index 38f68c64..5c8f0eb9 100644 --- a/src/pages/authentication/AuthWrapper.jsx +++ b/src/pages/authentication/AuthWrapper.jsx @@ -4,20 +4,17 @@ import "./page-auth.css"; export const AuthWrapper = ({ children }) => { return (
- {/*
{/*
-
*/}
*/}
-
- + marco-logo { {/*
*/} - {/*
*/} {children}
//
//
- //
- //
); }; \ No newline at end of file diff --git a/src/pages/authentication/ForgotPasswordPage.jsx b/src/pages/authentication/ForgotPasswordPage.jsx index 8223cf32..8a6fc608 100644 --- a/src/pages/authentication/ForgotPasswordPage.jsx +++ b/src/pages/authentication/ForgotPasswordPage.jsx @@ -1,6 +1,5 @@ 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"; @@ -8,21 +7,16 @@ 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 }, @@ -33,28 +27,15 @@ 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) { @@ -63,12 +44,6 @@ 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) } } @@ -122,11 +97,6 @@ const ForgotPasswordPage = () => { - - {/* Footer Text */} - - - ); }; diff --git a/src/pages/authentication/LoginPage.jsx b/src/pages/authentication/LoginPage.jsx index 7d1484dc..9240e33d 100644 --- a/src/pages/authentication/LoginPage.jsx +++ b/src/pages/authentication/LoginPage.jsx @@ -1,13 +1,11 @@ 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(); @@ -20,17 +18,11 @@ 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, @@ -43,24 +35,20 @@ const LoginPage = () => { const onSubmit = async (data) => { setLoading(true); try { - const username = data.username.trim(); - const password = data.password?.trim(); - if (!IsLoginWithOTP) { const userCredential = { - username, - password, + username: data.username, + password: data.password, }; - const response = await AuthRepository.login(userCredential); localStorage.setItem("jwtToken", response.data.token); localStorage.setItem("refreshToken", response.data.refreshToken); setLoading(false); navigate("/dashboard"); } else { - await AuthRepository.sendOTP({ email: username }); + await AuthRepository.sendOTP({ email: data.username }); showToast("OTP has been sent to your email.", "success"); - localStorage.setItem("otpUsername", username); + localStorage.setItem("otpUsername", data.username); localStorage.setItem("otpSentTime", now.toString()); navigate("/auth/login-otp"); } @@ -70,7 +58,6 @@ const LoginPage = () => { } }; - useEffect(() => { const otpSentTime = localStorage.getItem("otpSentTime"); if ( @@ -82,7 +69,6 @@ const LoginPage = () => { } }, [IsLoginWithOTP]); - return (
@@ -102,7 +88,7 @@ const LoginPage = () => { { {
)} - {/* Remember Me + Forgot Password */} -
-
- - -
- - Forgot Password? - -
- - )} - {/* Submit */} {/* Submit */} - {/* Login With OTP Button */} - {/* Login With OTP Button */} {!IsLoginWithOTP && ( <> @@ -233,40 +187,9 @@ const LoginPage = () => { Login With OTP - <> -
-
or
-
- - )} - - {/* Footer Text */} - {!IsLoginWithOTP ? ( -

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

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

@@ -288,9 +211,7 @@ const LoginPage = () => { )}

- - ); }; -export default LoginPage; +export default LoginPage; \ No newline at end of file diff --git a/src/pages/authentication/RegisterPage.jsx b/src/pages/authentication/RegisterPage.jsx index 23a7497a..c3d1000f 100644 --- a/src/pages/authentication/RegisterPage.jsx +++ b/src/pages/authentication/RegisterPage.jsx @@ -58,7 +58,6 @@ const RegisterPage = () => { fetchIndustries(); }, []); - useEffect(() => { }, [industries]); useEffect(() => { }, [industries]); const fetchIndustries = async () => { @@ -73,26 +72,24 @@ const RegisterPage = () => { return ( <> -
+
-

Adventure starts here

-

Make your app management easy and fun!

+

Adventure starts here 🚀

+

Make your app management easy and fun!

-
-
+
{
)}
-
+
{
)}
-
-
-
+
+
+
{errors.contactPerson && (
{
)}
-
+
+
+
{errors.contactNumber && (
{
)}
-
-