-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Prioritize using user.username
whenever provided
#8050
Conversation
@@ -0,0 +1,5 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file meant to be included / are the prettier changes meant to be included in this pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this isn't supposed to be here. I have added that to suppress prettier while I'm working on this, but I created #8136 to better address this.
Codecov Report
@@ Coverage Diff @@
## main #8050 +/- ##
=======================================
Coverage 77.66% 77.66%
=======================================
Files 236 236
Lines 16505 16505
Branches 3535 3535
=======================================
Hits 12819 12819
Misses 3575 3575
Partials 111 111 Continue to review full report at Codecov.
|
...ges/amplify-ui-components/src/components/amplify-confirm-sign-up/amplify-confirm-sign-up.tsx
Show resolved
Hide resolved
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Description of changes
This properly handles
username
input onconfirmSignUp
wheneverusernameAlias
is set tophone_number
.Problem
Before
confirmPassword
is submitted, we stringifyphone_number
usingcomposePhoneNumberInput(this.phoneNumber)
. The problem occurs when a validusername
has already been passed through theuser
prop. In that case, we disable the form forusername
and just use the provideduser.username
. But we still try to compose phone number fromthis.phoneNumber
, which is undefined, so we get an error message for that.This PR fixes it by prioritizing
username
to beuser.username
and only look at form values whenever it's not the case.Issue #, if available
Fixes #7267
Description of how you validated changes
Since
username
validations has been problematic especially with customusernameAlias
, I'll do testing across multiple auth components.usernameAlias = 'phone_number'
: testing with gistusernameAlias = 'email'
: testing with gistChecklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.