Feature/strengthen registration validation#1676
Merged
omroy07 merged 4 commits intoomroy07:mainfrom Feb 28, 2026
Merged
Conversation
|
@addz9015 is attempting to deploy a commit to the Om Roy's projects Team on Vercel. A member of the Team first needs to authorize it. |
Thanks for creating a PR for your Issue!
|
Owner
|
Comflict |
Contributor
Author
|
@omroy07 Have made the required changes please check. |
|
🎉 Congrats @addz9015 on getting your PR merged! 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #1524
Rationale for This Change
This update strengthens user registration data quality and reduces spam or fake account creation by enforcing stricter validation rules at both the model and API layers.
Restricting registration to
@gmail.comaddresses reduces disposable-domain abuse for this release and ensures consistent email handling across the application.Adding structured validation also:
What Changes Are Included in This PR?
1. Model-Level Validation (
user.py)full_name(or fallback tousername) to match letters and spaces onlyemailto be a@gmail.comaddressValueErrorif validation fails2. Route-Level Validation (
routes.py)Add
validate_email()to enforce Gmail-only addressesUpdate
/api/auth/registerto enforce:Full-name regex validation
Gmail-only email domain
Password strength requirements:
Return appropriate HTTP responses:
400— Validation failures (descriptive error messages)409— User already exists3. Tests Added (
test_registration_validation.py)Unit Tests
full_nameIntegration Tests
/api/auth/register/api/v1/registerendpointFiles Modified / Added
user.pyroutes.pytest_registration_validation.pyAre These Changes Tested?
Yes — new unit and integration tests were added in
test_registration_validation.py.Run Tests Locally
From project root:
Or run the full test suite:
Are There Any User-Facing Changes?
Yes.
The registration form and API now:
If client-side validation is enabled, users will also see aligned frontend error messaging.
Notes
This is an incremental, non-breaking change to registration behavior.
It affects users attempting to register with:
If needed, the validation can be updated to support:
Proof