aws-amplify / amplify-ui

Amplify UI is a collection of accessible, themeable, performant React (and more!) components that can connect directly to the cloud.
https://ui.docs.amplify.aws
Apache License 2.0
912 stars 293 forks source link

user verification authentication step should be skipped when there is nothing to verify #4819

Open houbie opened 11 months ago

houbie commented 11 months ago

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Authenticator

How is your app built?

Create React App

What browsers are you seeing the problem on?

No response

Which region are you seeing the problem in?

No response

Please describe your bug.

After a user (without email nor phone user attribute) signed in, the user verification component is shown. Clicking on the Verify button always results in an error since there is nothing to verify.

What's the expected behaviour?

Currently the emailNotVerified and phoneNotVerified are used to decide if verification is required. Verification should not be required if both email and phone attributes are absent. In this case there is nothing to verify and the verification will fail showing a validation error.

Help us reproduce the bug!

Cognito setup:

After a user has signed in (using the amplify sign in component), he is requested to verify his account. Since there is no email nor phone, there is no radio button shown to select what you want to verify and verification always fails.

Note: the user verification component has another bug; when the user has an email set, the user verification component shows a radio button with the email, but the user can click the verify button without selecting the radio button. This always results in an ugly error to be shown. The verify button should be disabled if nothing is selected.

Code Snippet

No response

Console log output

No response

Additional information and screenshots

After signing in with email attribute not set:

no_email_set_and_nothing_to_select

Error when clicking Verify:

verify_error

Error when clicking Verify when email is set, but not selected:

eror_when_nothing_selected
renanwilliam commented 7 months ago

It looks like an error in your Cognito user pool/user pool client. Could you please share your configuration?