Skip to content

Commit

Permalink
feat: implement name validation in user registration (#836)
Browse files Browse the repository at this point in the history
Co-authored-by: Ayusht777 <talesarayush@gmail.com>
  • Loading branch information
Ayusht777 and Ayusht777 authored Jan 13, 2024
1 parent e7cf3db commit a8639e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pages/contact.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ function Contact() {
e.preventDefault();

handleSubmit;

const NameRegex = /^[a-zA-Z\s]+$/;
if (values.message === "") {
showToast("Please enter a message!");
} else if (values.name === "") {
showToast("Please enter a name!");
} else if (!NameRegex.test(values.name)) {
showToast("Please enter a valid name");
} else if (values.email === "") {
showToast("Please enter a email!");
} else if (values.subject === "") {
Expand Down

0 comments on commit a8639e8

Please sign in to comment.