Skip to content

feat(validation): clarify username format and uniqueness error messages - #339

Merged
trtajim merged 1 commit into
mainfrom
feat/custom-username-validation-messages
Sep 11, 2026
Merged

feat(validation): clarify username format and uniqueness error messages#339
trtajim merged 1 commit into
mainfrom
feat/custom-username-validation-messages

Conversation

@trtajim

@trtajim trtajim commented Sep 11, 2026

Copy link
Copy Markdown
Member

Description

This PR improves user experience during profile edits and user onboarding by providing clear and explicit validation messages when username requirements are not met:

  • Format / Regex: Username can only contain letters, numbers, and underscores. Dots aren't allowed.
  • Uniqueness: This username is already taken. Please choose another one.

Changes

  • Added custom messages() in UpdateProfileRequest, StoreUserRequest, and UpdateUserRequest.
  • Updated AuthController onboarding username validation message.
  • Added feature tests in ProfileUsernameTest to verify clear error messages on invalid format and duplicate usernames.

Summary by CodeRabbit

  • Bug Fixes

    • Improved username validation messages across onboarding, profile updates, and user management.
    • Clearly explains that dots are not allowed in usernames.
    • Provides a specific message when a username is already taken.
  • Tests

    • Added coverage for invalid username formats and duplicate usernames during profile updates.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f3e51b08-1a70-491f-b9e2-3209e1c2aa96

📥 Commits

Reviewing files that changed from the base of the PR and between 97fd6f1 and 7282aea.

📒 Files selected for processing (5)
  • app/Http/Controllers/AuthController.php
  • app/Http/Requests/Profile/UpdateProfileRequest.php
  • app/Http/Requests/User/StoreUserRequest.php
  • app/Http/Requests/User/UpdateUserRequest.php
  • tests/Feature/ProfileUsernameTest.php

📝 Walkthrough

Walkthrough

Username validation now returns explicit messages for invalid characters and duplicate values. Profile feature tests verify both messages.

Changes

Username validation

Layer / File(s) Summary
Validation message contracts
app/Http/Requests/Profile/UpdateProfileRequest.php, app/Http/Requests/User/StoreUserRequest.php, app/Http/Requests/User/UpdateUserRequest.php, app/Http/Controllers/AuthController.php
Request classes define custom messages for username format and uniqueness rules. The authentication message states that dots are not allowed.
Profile validation coverage
tests/Feature/ProfileUsernameTest.php
Feature tests verify the messages for usernames containing dots and usernames already in use.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/custom-username-validation-messages

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.

@trtajim
trtajim merged commit 2b699b5 into main Sep 11, 2026
5 of 6 checks passed
@trtajim
trtajim deleted the feat/custom-username-validation-messages branch September 11, 2026 14:16
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