Skip to content

Enhance signup form validation and user feedback handling#265

Open
DeepakGhenyar wants to merge 4 commits into
GitMetricsLab:mainfrom
DeepakGhenyar:feature/improve-signup-validation
Open

Enhance signup form validation and user feedback handling#265
DeepakGhenyar wants to merge 4 commits into
GitMetricsLab:mainfrom
DeepakGhenyar:feature/improve-signup-validation

Conversation

@DeepakGhenyar
Copy link
Copy Markdown

@DeepakGhenyar DeepakGhenyar commented May 15, 2026

Related Issue


Description

Enhanced the signup form validation and improved the overall user experience by adding real-time validation and better feedback handling.

Changes Made

  • Added real-time validation for username, email, and password fields
  • Prevented invalid and whitespace-only inputs
  • Added proper email format validation
  • Added password strength validation
  • Added field-specific error messages
  • Implemented show/hide password functionality
  • Improved overall form feedback and reliability

How Has This Been Tested?

  • Tested invalid username inputs
  • Tested invalid email formats
  • Tested weak password validation
  • Tested whitespace-only inputs
  • Tested show/hide password functionality
  • Verified successful form submission flow locally

Screenshots (if applicable)

Screenshot 2026-05-15 at 11 34 50 PM ---

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • New Features
    • Redesigned signup page layout and styling for a cleaner experience.
    • Real-time client-side validation with inline, field-specific error messages for username, email, and password.
    • Password visibility toggle (show/hide) for easier input.
    • Prevents submission when validation fails and directs users to the login page upon successful registration; shows a failure message on request errors.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 22ce40f
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a09f30fc09a150008d27bdb
😎 Deploy Preview https://deploy-preview-265--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@DeepakGhenyar has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 44 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c916baa-f982-409e-a627-474eb41d7bcf

📥 Commits

Reviewing files that changed from the base of the PR and between aa21afb and 22ce40f.

📒 Files selected for processing (1)
  • src/pages/Signup/Signup.tsx
📝 Walkthrough

Walkthrough

The signup form now validates username, email, and password fields on input with inline error messages. Password visibility is toggled via eye/eye-off icons. Form submission is blocked if validation errors exist; otherwise, a POST to the backend signup endpoint is attempted with proper navigation or error feedback.

Changes

Form validation and password visibility

Layer / File(s) Summary
Imports and component state
src/pages/Signup/Signup.tsx
Adds navigation and lucide icon imports; introduces errors state and showPassword boolean.
Validation logic and submit flow
src/pages/Signup/Signup.tsx
Per-field validation for username, email, password in handleChange; handleSubmit revalidates, blocks submission on errors, posts formData to POST ${backendUrl}/api/auth/signup, sets message, and navigates to /login only when backend message equals "User created successfully".
UI rendering and password visibility
src/pages/Signup/Signup.tsx
Inputs render conditional inline <p> error elements; password field uses an eye/eye-off toggle to switch input type using showPassword; message banner remains driven by message.
Footer login CTA
src/pages/Signup/Signup.tsx
Updates footer link to point to /login while keeping "Already have an account?" copy.
Module export
src/pages/Signup/Signup.tsx
Retains export default SignUp at file end.

Sequence Diagram

sequenceDiagram
  participant User
  participant SignupComponent as Signup Component
  participant Backend as POST /api/auth/signup
  participant Router as Navigation (/login)

  User->>SignupComponent: type username/email/password
  SignupComponent->>SignupComponent: validate field, update `errors`
  SignupComponent-->>User: show or clear inline field error

  User->>SignupComponent: click submit
  SignupComponent->>SignupComponent: revalidate all fields
  alt validation errors exist
    SignupComponent-->>User: prevent submit, show errors
  else no validation errors
    SignupComponent->>Backend: POST {username,email,password}
    Backend-->>SignupComponent: response {message}
    alt message == "User created successfully"
      SignupComponent->>Router: navigate to /login
    else
      SignupComponent-->>User: show backend message or generic error
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A little rabbit hops with cheer,
Fields that warn before you send,
An eye that blinks to make passwords clear,
Messages that guide you to the end.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes: adding validation and improving user feedback on the signup form.
Description check ✅ Passed The description follows the template structure with all required sections: Related Issue, Description, How Has This Been Tested, Screenshots, and Type of Change.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from #263: real-time validation for username/email/password, prevention of invalid/whitespace inputs, email format validation, field-specific error messages, and show/hide password functionality.
Out of Scope Changes check ✅ Passed All changes are directly related to the signup form validation objectives. The commit message mentions color adjustments to black/white for accessibility, which aligns with improving the form's visual accessibility and is in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/Signup/Signup.tsx`:
- Around line 41-45: The email validation in the Signup component uses an
unanchored regex against untrimmed input which permits malformed emails; update
the logic in the block where name === "email" to first use const trimmed =
value.trim() and validate trimmed (not raw value), and replace the regex
/\S+@\S+\.\S+/ with an anchored, stricter pattern (e.g. start/end anchors and
better local/domain checks) when setting errorMessage so malformed values are
rejected; ensure errorMessage is set based on trimmed input and the
function/handler (the code that references name, value, and errorMessage) uses
the trimmed, validated value thereafter.
- Around line 166-172: The password visibility toggle button is icon-only and
lacks an accessible name; update the button (the element using setShowPassword
and showPassword that renders Eye/EyeOff) to provide an accessible label and
state, e.g., add an aria-label that changes with showPassword (e.g., "Show
password" vs "Hide password") and consider adding aria-pressed or title for
additional context so screen readers announce its purpose and current state.
- Around line 65-70: The submit handler handleSubmit currently only checks the
existing errors object, so untouched invalid fields let bad payloads through;
update handleSubmit to re-run validation against current formData on submit
(e.g., call your validate/validateAll function or validateField for each field
with formData.username, formData.email, formData.password), update/set the
errors state with any returned issues, and abort submission if any validation
errors are present before posting the payload; ensure this revalidation handles
async validators by awaiting the validator if needed and then returning early
when errors exist.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7c43668-cf1c-4f48-9185-77390d004381

📥 Commits

Reviewing files that changed from the base of the PR and between 7a15543 and 8539d1e.

📒 Files selected for processing (1)
  • src/pages/Signup/Signup.tsx

Comment thread src/pages/Signup/Signup.tsx Outdated
Comment thread src/pages/Signup/Signup.tsx Outdated
Comment thread src/pages/Signup/Signup.tsx Outdated
@mehul-m-prajapati
Copy link
Copy Markdown
Collaborator

all bg colors are bad, use simple colors -> white and black @DeepakGhenyar

@DeepakGhenyar
Copy link
Copy Markdown
Author

Hey @mehul-m-prajapati , I have resolved all merge conflicts and addressed all the CodeRabbit review comments:

  • ✅ Fixed email validation regex
  • ✅ Added full revalidation on submit (empty field check)
  • ✅ Added aria-label and aria-pressed to password toggle (accessibility)
  • ✅ Updated all background colors to simple white/black as requested
  • ✅ Integrated ThemeContext for dark/light mode support

Could you please re-add the gssoc:approved label? Thank you! 🙏

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Enhance signup form validation and user feedback handling

2 participants