fix(profile): improve full name validation with clearer error messages#1396
fix(profile): improve full name validation with clearer error messages#1396rohilsurana merged 6 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughName 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
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. Comment |
Pull Request Test Coverage Report for Build 22303112106Details
💛 - Coveralls |
There was a problem hiding this comment.
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' + )
b16c771 to
6625980
Compare
There was a problem hiding this comment.
♻️ 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.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Changes
Test plan