amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

Username is cached for use in confirmPassword on Android

Open ssantomauro opened this issue 4 years ago • 5 comments

Describe the bug Amplify.Auth.confirmPassword is not displaying any error when the email/username and the Verification Code don't match. In JS the check exists.

To Reproduce Steps to reproduce the behavior:

  1. Reset password
  2. Copy the Verification Code from the email
  3. Paste the Verification Code
  4. Insert a wrong e-mail address

Expected behavior Expected an error message

Platform Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply): [x] Android [] iOS (I don't know)

pubspec.yaml ... amplify_flutter: "<1.0.0" amplify_auth_cognito: "<1.0.0" ...

ssantomauro avatar Mar 23 '21 00:03 ssantomauro

@ssantomauro How are you trying to catch the error?

haverchuck avatar Mar 23 '21 01:03 haverchuck

This is my code:

try {
      await Amplify.Auth.confirmPassword(
          username: email,
          newPassword: newPassword,
          confirmationCode: verificationCode);
} catch (error) {
  print(error);
  throw (error);
}

It's the way I'm using for the signIn and signOut as well.

ssantomauro avatar Mar 23 '21 23:03 ssantomauro

@ssantomauro Ok I think I found the issue. In Android, our underlying amplify-android library just caches the username when the initial resetPassword method is called (while iOS requires it to be passed). We will work to resolve this discrepancy.

haverchuck avatar Mar 24 '21 16:03 haverchuck

Thanks!

ssantomauro avatar Mar 25 '21 16:03 ssantomauro

Hello @ssantomauro - We have recently released a new developer preview version of the Auth category (amplify_flutter v1.0.0-next.0). This new version is a full re-write of the auth category in dart, and it supports Mobile, Desktop, and Web. This issue is addressed in this new version. You can read more about the developer preview release in the blog post and docs. I will update this issue again once this new version is out of developer preview.

Let me know if you have any questions!

Jordan-Nelson avatar Aug 02 '22 19:08 Jordan-Nelson

This issue has been addressed in v1.0.0 of Amplify Flutter, which is now stable. This release also includes web and desktop support for Auth, API, Analytics, and Storage. You can see the list of new features and bug fixes in the release notes, and see more details on how to migrate in the upgrade guide.

Jordan-Nelson avatar Apr 17 '23 18:04 Jordan-Nelson