Skip to content

🐛 Bug Report: Fix: Align frontend username validation with backend validation rules #709

@Tanayajadhav1

Description

@Tanayajadhav1

📜 Description

Description:

Problem:
The frontend username validation in src/pages/Signup/Signup.tsx currently only allows letters and spaces:

/^[A-Za-z\s]+$/

However, the backend validation allows letters, numbers, and underscores:

/^[a-zA-Z0-9_]+$/

This creates an inconsistency where usernames that are valid on the backend are incorrectly rejected by the frontend before submission.

Expected Behavior:

  • Frontend validation should match backend validation rules exactly so that:
  • Valid usernames are accepted consistently across the application.
  • Users receive accurate validation feedback.
  • Registration behavior is predictable and reliable.

Proposed Fix:
Update username validation in src/pages/Signup/Signup.tsx to use:
/^[A-Za-z0-9_]+$/

Replace the current validation message:
Only letters are allowed

with:
Username can only contain letters, numbers, and underscores

Apply the same validation rule both during field validation and form submission validation.

Benefits:

  • Eliminates frontend/backend validation mismatch.
  • Allows valid usernames such as user_123 and john_doe.
  • Improves user experience by preventing false validation errors.
  • Keeps validation behavior consistent throughout the registration flow.

Affected File:
src/pages/Signup/Signup.tsx

Labels:
bug
frontend
validation
good first issue
gssoc
level:intermediate

i would like to work on this issue under gssoc'26

What browsers are you seeing the problem on?

No response

📃 Relevant Screenshots (Links)

No response

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions