diff --git a/app/(pages)/(auth)/login/page.tsx b/app/(pages)/(auth)/login/page.tsx index f8b607c4..6a37676b 100644 --- a/app/(pages)/(auth)/login/page.tsx +++ b/app/(pages)/(auth)/login/page.tsx @@ -246,17 +246,6 @@ export default function Login() { - {/* COMMENTED FOR NOW --- GOOGLE LOGIN */} - {/*
-
-
or continue
-
-
- - */}

Don't have an account? diff --git a/app/(pages)/(auth)/signup/page.tsx b/app/(pages)/(auth)/signup/page.tsx index 60d833e1..80b9c493 100644 --- a/app/(pages)/(auth)/signup/page.tsx +++ b/app/(pages)/(auth)/signup/page.tsx @@ -1,5 +1,5 @@ "use client"; -import { useState, useRef, type ChangeEvent } from "react"; +import { useState, useRef, type ChangeEvent, useEffect } from "react"; import { AiTwotoneEye, AiOutlineEyeInvisible } from "react-icons/ai"; import { carouselData, roles } from "@constants/index"; import { Carousel, OtpSection } from "@components/index"; @@ -31,6 +31,7 @@ export default function Signup() { const [confirmPassword, setconfirmPassword] = useState(""); const [confirmPasswordError, setConfirmPasswordError] = useState(""); const [isVisible, setIsVisible] = useState(false); + const [submitDisabled, setSubmitDisabled] = useState(true); const [showOtp, setShowOtp] = useState(false); const [userData, setUserData] = useState({ email: "", role: "", action: "" }); @@ -156,6 +157,13 @@ export default function Signup() { )}.` : "Password is too short. It must be at least 8 characters long." ); + + if (e.target.value !== passwordRef.current?.value) { + setConfirmPasswordError( + "Passwords do not match. Please ensure that your password and confirm password are identical." + ); + } + setconfirmPassword(e.target.value); } @@ -246,6 +254,41 @@ export default function Signup() { } } }; + + useEffect(() => { + setSubmitDisabled(isSubmitDisabled()); + }, [ + firstNameError, + firstName, + lastNameError, + lastName, + usernameError, + username, + emailError, + email, + passwordError, + password, + confirmPasswordError, + confirmPassword, + ]); + + function isSubmitDisabled(): boolean { + return ( + !!firstNameError || + !firstName || + !!lastNameError || + !lastName || + !!usernameError || + !username || + !!emailError || + !email || + !!passwordError || + !password || + !!confirmPasswordError || + !confirmPassword + ); + } + return (

Sign up + {/* passing the user data to otp section */} {showOtp && } - - - - {/*
-
-
or continue
-
-
- - */}

Have an account?{" "}