Skip to content

feat(onboarding): restrict display name to ASCII letters, digits and spaces - #1641

Merged
bmc08gt merged 2 commits into
code/cashfrom
feat/onboarding-display-name-ascii
Sep 30, 2026
Merged

bmc08gt merged 2 commits into
code/cashfrom
feat/onboarding-display-name-ascii

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

During onboarding, the display name is now accepted only if, after trimming, it is 1–64 characters of A-Z, a-z, 0-9 or a space (U+0020). Any other name keeps Next disabled, the same way a blank name does today. My Account and tip-card setup still only require a non-blank name.

  • OnboardingDisplayNameRule.kt holds the rule as a pure function with no Android types.
  • NameEntryViewModel.State.isSubmittable(source) applies it for DisplayNameSource.Onboarding only, and NameEntryScreen gates Next on it.
  • Trimming strips U+0009–U+000D, U+0085 and the Zs/Zl/Zp categories, the same set as iOS .whitespacesAndNewlines. Kotlin trim() misses NBSP, so "Taylor\u00A0" would have been rejected here and accepted on iOS.
  • Onboarding now sends the trimmed name to setDisplayName, as iOS does. Before, every source sent the raw field text. My Account and tip-card setup still send it as typed.
  • The keyboard Done action sends ConfirmNameChange without going through the button's enabled check. For Onboarding, the view model now drops an invalid name there too. iOS OnboardingNameViewModel.submit() already guards on its validator in the same way.

iOS applies the same rule in code-payments/code-ios-app#933.

OnboardingDisplayNameRuleTest covers accepted, trimmed and double-space names; rejected accents, punctuation, emoji, tab, newline, NBSP, all-space and 65-character names; the 64-character boundary; and non-ASCII names staying valid for the other two sources.

…spaces

Onboarding now requires the trimmed name to be 1-64 characters of A-Z, a-z,
0-9 or U+0020. MyAccount and TipCardSetup keep the non-blank rule.
Kotlin trim() strips only chars <= U+0020, so a trailing NBSP or ideographic
space failed validation on Android but passed on iOS. Trim U+0009-U+000D,
U+0085 and categories Zs/Zl/Zp on both ends, and submit the trimmed name for
Onboarding instead of the raw field text.
@bmc08gt
bmc08gt merged commit 3cba6a1 into code/cash Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant