Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Auto-filled phone numbers contain characters rejected by Cognito #56

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

ruisebas
Copy link
Member

@ruisebas ruisebas commented Mar 8, 2024

Issue #, if available:

Description of changes:

Cognito's expectations for a phone number is to be fully numerical except for the initial + sign.
Although the Authenticator's Phone Number Field only shows the numeric keyboard for manual input, it's still possible to end up with non-numeric characters by using the Auto-Fill option, or simply by pasting a phone number from the clipboard.

The problem is that phone numbers are typically formatted in a way that include hyphens, spaces and parentheses (e.g. +1 (123) 456-7890 instead of just +11234567890). So attempting to submit a phone number using any of these characters results in an error, as Cognito rejects the request.

While the easiest fix would be to remove any non-numeric character from being displayed in the Phone Number Field, I've decided to allow them on the customer facing field, but remove them from the internal field that is used when submitting to Cognito. The reasoning for this is that striping formatting would create a subpar experience for customers using Auto-Fill or pasting phone numbers.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ruisebas ruisebas requested review from a team as code owners March 8, 2024 20:49
harsh62
harsh62 previously approved these changes Mar 8, 2024
@ruisebas ruisebas merged commit 36d96ea into main Mar 11, 2024
3 checks passed
@ruisebas ruisebas deleted the ruisebas/fix-phone-validation branch March 11, 2024 19:08
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