Skip to content

Commit

Permalink
Add form validation to email in registration (#290)
Browse files Browse the repository at this point in the history
* feat: add regex check to validate email

* fix: use existing checkEmail function
  • Loading branch information
thywang authored Aug 1, 2023
1 parent 499bff9 commit 5035561
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 5035561

Please sign in to comment.