Skip to content

register: fix username label and add uniqueness check#127

Merged
Boy132 merged 2 commits intopelican-dev:mainfrom
rxtted:fix/register-username-label-and-unique
May 1, 2026
Merged

register: fix username label and add uniqueness check#127
Boy132 merged 2 commits intopelican-dev:mainfrom
rxtted:fix/register-username-label-and-unique

Conversation

@rxtted
Copy link
Copy Markdown
Contributor

@rxtted rxtted commented May 1, 2026

before:

the username override renames the parent's name input but keeps the parent's label, which resolves to
"name". the form rendered a field labeled "name" while binding to the username column users sign in with.

the override also dropped the parent's unique check, so duplicate-username submissions fell through to user creation and surfaced the database unique index violation as an unhandled error.

change:

added an explicit username label using the panel's existing translation key, and a unique validation rule scoped to the username column. mirrors how the parent handles the email field.

after:

the field renders with the label "Username". duplicate submissions show "The username has already been taken."

Summary by CodeRabbit

  • Bug Fixes
    • Registration username now enforces uniqueness to prevent duplicate accounts.
    • Username label is localized, showing the correct text for the user's language.
    • Validation and labeling improvements ensure clearer feedback on the registration form and reduce sign-up errors.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f1a7491-8d2e-4d2e-9fd0-ab3f62e616d2

📥 Commits

Reviewing files that changed from the base of the PR and between 0480686 and 6390c87.

📒 Files selected for processing (1)
  • register/src/Filament/Pages/Auth/Register.php

📝 Walkthrough

Walkthrough

The registration page's username TextInput now sets its label to trans('profile.username') and enforces uniqueness via unique($this->getUserModel(), 'username').

Changes

Cohort / File(s) Summary
Registration Form Field
register/src/Filament/Pages/Auth/Register.php
Set username field label to trans('profile.username') and added a uniqueness validation constraint targeting the configured user model's username column (unique($this->getUserModel(), 'username')).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A tiny tweak to name and rule,
Labelled kindly, tidy and cool,
One-of-a-kind, no twins allowed,
New usernames stand tall and proud,
Hooray — the register form hums aloud! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the two main changes: fixing the username label and adding a uniqueness check, which directly correspond to the primary modifications in the changeset.

✏️ 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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@rxtted rxtted changed the title register: fix username label and add uniqueness check register: fix username label and add uniqueness check May 1, 2026
Copy link
Copy Markdown
Member

@Boy132 Boy132 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread register/src/Filament/Pages/Auth/Register.php Outdated
@Boy132 Boy132 merged commit e7252f5 into pelican-dev:main May 1, 2026
6 of 7 checks passed
@rxtted rxtted deleted the fix/register-username-label-and-unique branch May 1, 2026 14:59
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.

2 participants