Closed kjallbring closed 2 years ago
The same thing happens with ConfirmSignup , when pre-populating the email
Use case :
@chrisbonifacio @kjallbring do you know about a possible workaround?
Like, is it possible to pass the "value" into the Auth state somehow? As it seems it is now aware of the value
When updating even a single string in "email" for example, it is bind'ed correctly and getting recognized.
Looks like this is same as https://github.com/aws-amplify/amplify-js/pull/6211
I think this code is invoked when passing in value.
But I suspect it does not trigger an event, so this code is NOT called.
And that causes userInput to be null/undefined here
From what I'm reading, this should be addressed in our @next
release via:
Hi @kjallbring , this shouldn't be an issue any longer in our new version of the authenticator. Take a look at our docs here on how to get started with it - https://ui.docs.amplify.aws/ui/getting-started/installation?platform=react
Going to close this issue for now since this issue shouldn't be present in the new authenticator, but please open a new ticket if it still doesn't work for you.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
I use the AmplifyForgotPassword component both for non authenticated users ("forgot" password) and for authenticated users ("reset" password). I recently upgraded to the latest version of Amplify, since the issue with duplicate formFields had recently been fixed.
Related PRs: https://github.com/aws-amplify/amplify-js/pull/8633/commits/b1a50cb287846ef185ffecfc2d28551b2d02a895 https://github.com/aws-amplify/amplify-js/pull/6211/commits/22051cb9dc9a4b4c0fd1b3fb5b66c72df5eb6f5f
When I pre-populate the username (email) field for authenticated users ("reset" password), it shows up in the form, but results in a 400 response from Cognito saying that the username was not specified.
One of the reasons that I want to pre-populate the username field is that if the users enters a non-existent email by mistake, Cognito returns a 400 response, but no error message is visible in the UI.
When I try to pre-populate the username (email) for unauthenticated users (using a hard-coded email address), it results in the field being empty. The pre-population is not honored. I don't really care about this scenario so much, since it doesn't make any sense. I included it as an FYI.
I have attached a number of screenshots from the app in the
Additional information and screenshots
sectionExpected behavior
When I pre-populate the username (email) field for authenticated users ("reset" password), it should populate the form (it does), and result in a success response from Cognito, since the the username was specified.
Reproduction steps
When I use it for authenticated users ("reset" password), I pre-populate the username (email) field by assigning the email to the value prop. However, when the user clicks the
SEND CODE
button, nothing happens in the UI. I can see that the network call to Cognito returns a 400 response, indicating that the field was not populated.If the field is blank initially (no pre-population), and the user clicks the
SEND CODE
button, a warning message appears:Please fill out this field
If I pre-populate, the UI seems to be aware of it. but an empty value is sent to Cognito.
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
Username is pre-populated. Error response from Cognito. No message in the UI.
Warning message when the Username is NOT pre-populated
Non-existent email gets a 400 response, but nothing is visible in the UI
Second screen shown when valid email has been submitted