diff --git a/client/src/pages/auth/SignInPage.tsx b/client/src/pages/auth/SignInPage.tsx index c40385e7..526aad30 100644 --- a/client/src/pages/auth/SignInPage.tsx +++ b/client/src/pages/auth/SignInPage.tsx @@ -43,7 +43,9 @@ const SignInPage: React.FC = () => { useEffect(() => { const checkEmailExistence = async () => { - if (email && email.endsWith("@gmail.com")) { + const emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/g; + + if (email && emailPattern.test(email)) { setIsCheckingEmail(true) try { const exists = await checkEmailExists(email) @@ -109,7 +111,7 @@ const SignInPage: React.FC = () => { }`} {...register("email")} /> - {email && email.endsWith("@gmail.com") && ( + {email && ( {isCheckingEmail ? ( diff --git a/client/src/pages/auth/SignInPage2.tsx b/client/src/pages/auth/SignInPage2.tsx index 0e020efd..52d88392 100644 --- a/client/src/pages/auth/SignInPage2.tsx +++ b/client/src/pages/auth/SignInPage2.tsx @@ -43,7 +43,9 @@ const SignInPage2: React.FC = () => { useEffect(() => { const checkEmailExistence = async () => { - if (email && email.endsWith("@gmail.com")) { + const emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/g; + + if (email && emailPattern.test(email)) { setIsCheckingEmail(true) try { const exists = await checkEmailExists(email) @@ -118,8 +120,7 @@ const SignInPage2: React.FC = () => { className={`bg-gray-800 text-white ${errors.email ? "border-red-500" : ""}`} {...register("email")} /> - {email && - email.endsWith("@gmail.com") && ( + {email && ( {isCheckingEmail ? (
diff --git a/client/src/pages/auth/SignUpPage.tsx b/client/src/pages/auth/SignUpPage.tsx index 4b93334f..51168098 100644 --- a/client/src/pages/auth/SignUpPage.tsx +++ b/client/src/pages/auth/SignUpPage.tsx @@ -144,7 +144,9 @@ const SignUp: React.FC = () => { useEffect(() => { const checkEmailAvailability = async () => { - if (email && email.endsWith("@gmail.com")) { + const emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/g; + + if (email && emailPattern.test(email)) { setIsCheckingEmail(true) try { const emailExists = await checkEmailExists(email) @@ -239,7 +241,7 @@ const SignUp: React.FC = () => { }`} {...register("email")} /> - {email && email.endsWith("@gmail.com") && ( + {email && ( {isCheckingEmail ? ( diff --git a/client/src/pages/auth/SignUpPage2.tsx b/client/src/pages/auth/SignUpPage2.tsx index 8def8424..eac14b3a 100644 --- a/client/src/pages/auth/SignUpPage2.tsx +++ b/client/src/pages/auth/SignUpPage2.tsx @@ -124,7 +124,9 @@ const SignUp: React.FC = () => { useEffect(() => { const checkEmailAvailability = async () => { - if (email && email.endsWith("@gmail.com")) { + const emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/g; + + if (email && emailPattern.test(email)) { setIsCheckingEmail(true) try { const emailExists = await checkEmailExists(email) @@ -258,7 +260,7 @@ const SignUp: React.FC = () => { className={`bg-gray-800 text-white ${errors.email ? "border-red-500" : ""}`} {...register("email")} /> - {email && email.endsWith("@gmail.com") && ( + {email && ( {isCheckingEmail ? (