From 5035561e55ae9dc62048535d96354ed983624ee8 Mon Sep 17 00:00:00 2001 From: thywang <88808428+thywang@users.noreply.github.com> Date: Tue, 1 Aug 2023 00:55:19 -0400 Subject: [PATCH] Add form validation to email in registration (#290) * feat: add regex check to validate email * fix: use existing checkEmail function --- .../WaitlistExperience/PersonalInfo/personalInfoReducer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/pages/WaitlistExperience/PersonalInfo/personalInfoReducer.tsx b/frontend/src/components/pages/WaitlistExperience/PersonalInfo/personalInfoReducer.tsx index 17ee268e..31c83684 100644 --- a/frontend/src/components/pages/WaitlistExperience/PersonalInfo/personalInfoReducer.tsx +++ b/frontend/src/components/pages/WaitlistExperience/PersonalInfo/personalInfoReducer.tsx @@ -88,7 +88,8 @@ export const checkAge = ( }; export const checkEmail = (email: string): boolean => { - return !!email; + const emailRegex = new RegExp("[a-z0-9]+@[a-z]+\\.[a-z]{2,3}"); + return emailRegex.test(email); }; export const checkPhoneNumber = (phoneNumber: string): boolean => {