Skip to content

Comments

fix(profile): improve full name validation with clearer error messages#1396

Merged
rohilsurana merged 6 commits intomainfrom
fix/user-profile-name-validation
Feb 23, 2026
Merged

fix(profile): improve full name validation with clearer error messages#1396
rohilsurana merged 6 commits intomainfrom
fix/user-profile-name-validation

Conversation

@rohilsurana
Copy link
Member

Summary

  • Improved full name validation in user profile to allow only letters, spaces, periods, hyphens, and apostrophes
  • Ensured special characters (spaces, hyphens, apostrophes) can only appear after at least one letter
  • Added multiple validation rules with clear, specific error messages for better UX

Changes

  • Reordered validation checks to show most relevant error message first
  • Name must start and end with a letter
  • Special characters must be followed by a letter
  • No consecutive spaces allowed

Test plan

  • Test with valid names: "John Doe", "Mary-Jane O'Connor", "Dr. Smith"
  • Test invalid: trailing space shows "Name must end with a letter"
  • Test invalid: trailing hyphen shows "Name must end with a letter"
  • Test invalid: trailing apostrophe shows "Name must end with a letter"
  • Test invalid: numbers/symbols show "Name can only contain..."
  • Test invalid: space not followed by letter shows "Spaces must be followed by a letter"

@vercel
Copy link

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Feb 23, 2026 10:56am

@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Name validation in the user update form was refactored: names must start and end with a Unicode letter, may include periods, spaces, hyphens, and apostrophes, disallow consecutive spaces, and require spaces/hyphens/apostrophes to be followed by a letter; per-rule error messages were added.

Changes

Cohort / File(s) Summary
Name Validation Enhancement
web/lib/react/components/organization/user/update.tsx
Replaced the previous ASCII-only regex with Unicode-aware validation broken into multiple constraints: start-with-letter, end-with-letter, allowed punctuation (., space, hyphen, apostrophe), no consecutive spaces, and require that spaces/hyphens/apostrophes are followed by a letter. Updated error messages accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


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 and usage tips.

@coveralls
Copy link

coveralls commented Feb 18, 2026

Pull Request Test Coverage Report for Build 22303112106

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 38.457%

Totals Coverage Status
Change from base Build 22302832455: 0.0%
Covered Lines: 16200
Relevant Lines: 42125

💛 - Coveralls

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/lib/react/components/organization/user/update.tsx (1)

35-38: Simplify the "end with letter" regex — the single-char alternative |^[a-zA-Z]$ is unreachable dead code.

.min(2) is enforced before this .matches(), so a single-character string never reaches it. The entire two-alternative regex can be reduced to a simpler end-anchor check (the start constraint is already covered by the preceding rule):

♻️ Proposed simplification
-      .matches(
-        /^[a-zA-Z][a-zA-Z\s.'\-]*[a-zA-Z]$|^[a-zA-Z]$/,
-        'Name must end with a letter'
-      )
+      .matches(
+        /[a-zA-Z]$/,
+        'Name must end with a letter'
+      )

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@rohilsurana rohilsurana force-pushed the fix/user-profile-name-validation branch from b16c771 to 6625980 Compare February 23, 2026 10:53
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
web/lib/react/components/organization/user/update.tsx (1)

28-41: Period validation gap remains open — consecutive or chained periods still pass all checks.

"John..Doe" clears every rule: the character set allows ., neither the hyphen-follow nor apostrophe-follow rules fire, and the end-with-letter rule is satisfied. No rule enforces that a period must be followed by a letter (or space).

🛡️ Proposed fix — add a period-follow constraint
      .matches(
        /^(?!.*'[^\p{L}]).*$/u,
        'Apostrophes must be followed by a letter'
-     ),
+     )
+     .matches(
+       /^(?!.*\.[^\p{L} ]).*$/u,
+       'Periods must be followed by a letter or space'
+     ),

Using [^\p{L} ] (letter or literal space) keeps "Dr. Smith" valid while rejecting "John..Doe" and "Dr..Smith". If periods must be followed only by a letter (disallowing "Dr. Smith"), use [^\p{L}] instead — confirm against the intended test cases first.


ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c177d89 and b16c771.

📒 Files selected for processing (1)
  • web/lib/react/components/organization/user/update.tsx

@rohilsurana
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rohilsurana rohilsurana merged commit f49b584 into main Feb 23, 2026
8 checks passed
@rohilsurana rohilsurana deleted the fix/user-profile-name-validation branch February 23, 2026 11:05
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.

3 participants