Skip to content

Comments

fix: add client-side email validation to signup form using zod#25

Merged
binit2-1 merged 2 commits intobinit2-1:mainfrom
Mustansir-06:fix/signup-email-validation
Dec 22, 2025
Merged

fix: add client-side email validation to signup form using zod#25
binit2-1 merged 2 commits intobinit2-1:mainfrom
Mustansir-06:fix/signup-email-validation

Conversation

@Mustansir-06
Copy link
Contributor

Description

This PR addresses the issue where the signup form would allow invalid email formats (like test@) to be submitted to the backend without immediate feedback.

Changes Made:

  • Integrated Zod: Added zod for robust client-side schema validation.
  • Validation Interceptor: Added logic in Signup.jsx to catch invalid inputs before they reach the API, preventing unnecessary network calls.
  • Error Feedback: Implemented the requested error message: "Please enter a valid email address".
  • UX Improvement: Changed the email input type to text to ensure our custom error box handles all validation feedback consistently.

Fixes

Closes #23

@vercel
Copy link

vercel bot commented Dec 21, 2025

@Mustansir-06 is attempting to deploy a commit to the binit2-1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@binit2-1
Copy link
Owner

binit2-1 commented Dec 21, 2025

Thanks for implementing this! The Zod validation works great 🎉

I have a few small suggestions before merging:

1. Keep type="email" for better mobile UX

Current approach:

<input type="text" ... />

//Suggested

<form onSubmit={handleSubmit} noValidate>
  <input 
    type="email" 
    autoComplete="email"
    ...
  />
</form>

2.Root package.json files

I noticed package.json and package-lock.json were added to the root directory. Were these intentional?
If not, we should remove them:

git rm package.json package-lock.json

@Mustansir-06
Copy link
Contributor Author

Thanks for the review, @binit2-1! I've addressed your suggestions:

Updated the email input to type="email" and added autoComplete for better mobile UX. I also added noValidate to the form to ensure our Zod validation handles the error messaging.

Removed the accidental package.json and package-lock.json files from the root directory.

Let me know if there's anything else!

@binit2-1 binit2-1 merged commit 99c3885 into binit2-1:main Dec 22, 2025
1 check failed
@binit2-1
Copy link
Owner

@Mustansir-06 Thanks for contribution, I have merged your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Signup form does not validate email format

2 participants