Skip to content

feat(auth): add username validation to restrict special characters#272

Open
AJ-Collins wants to merge 3 commits intokaw393939:mainfrom
AJ-Collins:issue-username-validation
Open

feat(auth): add username validation to restrict special characters#272
AJ-Collins wants to merge 3 commits intokaw393939:mainfrom
AJ-Collins:issue-username-validation

Conversation

@AJ-Collins
Copy link

What this PR does

This pull request introduces validation logic to prevent usernames with special characters during user registration. This ensures cleaner, more secure user input and aligns with standard username formats.
Changes Summary

 Enforced username validation using a regex pattern (^[a-zA-Z0-9_]+$)

 Rejected usernames with characters like @, #, !, %, etc.

 Added unit tests for:

    Valid usernames (e.g., john_doe, Alice123)

    Invalid usernames (e.g., user@name, name!, bob#smith)

Verified all tests pass with pytest

How to Test

Run the test suite:

pytest

Try registering a new user with a special character in the username — it should raise a validation error.

Related

Closes #10 (or mention the appropriate issue)

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.

1 participant