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

Authenticator: fix issue where phone_number validation fails #1014

Merged
merged 2 commits into from
Dec 18, 2021

Conversation

reesscot
Copy link
Contributor

Issue #, if available:
Closes #1008

Description of changes:

This fixes an issue where phone number validation fails for country code +1 when there are other form validation errors such as a short password. This causes the phone_number value to be mutated, and N number of +1's to be appended (where N is number of times the form has been submitted):

UserAttributes: { phone_number: "+1+1+12223334444"}
Username: "+1+1+12223334444

The fix ensures that formValues.phone_number is not mutated on each signUp call.

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

This fixes an issue where 2223334444 phone number format fails when there are other form validation errors such as a short password. The fix ensures that formValues.phone_number is not mutated on each signUp call.
@changeset-bot
Copy link

changeset-bot bot commented Dec 17, 2021

🦋 Changeset detected

Latest commit: 86ca9ce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@aws-amplify/ui Patch
@aws-amplify/ui-react Patch
@aws-amplify/ui-vue Patch
@aws-amplify/ui-angular Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1014.d3inl0muob87le.amplifyapp.com

@reesscot reesscot temporarily deployed to ci December 17, 2021 21:13 Inactive
@reesscot reesscot temporarily deployed to ci December 17, 2021 21:13 Inactive
@reesscot reesscot temporarily deployed to ci December 17, 2021 21:13 Inactive
@reesscot reesscot temporarily deployed to ci December 17, 2021 21:13 Inactive
@reesscot reesscot requested a review from ErikCH December 17, 2021 21:23
@reesscot reesscot changed the title Fix issue where phone_number validation fails Authenticator: fix issue where phone_number validation fails Dec 17, 2021
if (formValues.phone_number) {
formValues.phone_number =
Copy link
Contributor

Choose a reason for hiding this comment

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

The fix ensures that formValues.phone_number is not mutated on each signUp call.

You said it! Mutations are a huge risk!

I'm redoing #911, but that fixes phone_number to always be a computed value in the form so that this logic doesn't need to live in the machine.

Copy link
Contributor

@zchenwei zchenwei left a comment

Choose a reason for hiding this comment

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

LGTM

@reesscot reesscot merged commit 43634b0 into main Dec 18, 2021
@reesscot reesscot deleted the fix-auth-phone-number-validation branch December 18, 2021 00:04
@github-actions github-actions bot mentioned this pull request Dec 18, 2021
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.

Amplify - Authentication / Cognito - React - Create User - Invalid phone number format
3 participants