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

🐛 [UI] Forgot Password exception message persisting even after email successfully sent #8804

Closed
BrutalCoding opened this issue May 30, 2022 · 2 comments · Fixed by #9992
Closed
Assignees
Labels
plugin: ui resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working

Comments

@BrutalCoding
Copy link
Contributor

BrutalCoding commented May 30, 2022

Bug report

Describe the bug
When visiting "Forgot Password", you are able to type in an email. In some cases, you will trigger a FirebaseAuthException and when that happens, the exception message sticks around on the next screen even though the e-mail has been sent off successfully.

I have added solutions to fix this bug at the bottom of this post in the section 'Additional context'.

Steps to reproduce

1. Confirm basic textfield form validation

The email textfield has basic form validation, e.g. typing in "abc" and tapping "Reset password" will display the following textfield validation error: "Provide a valid email", thats good.

Now try the e-mail "john.doe@example", and tap on "Reset password". It will still display "Provide a valid email", so far so good.
image

2. Cause a FirebaseAuthException on purpose

2.1. Using non-existing Firebase Auth e-mail

Type in an e-mail that you do not have in your Firebase Auth instance, it will trigger the following Exception: "Account doesn't exist"
image

(Optional) 2.2. - Hardware keyboard

Optionally, you can cause another exception by typing in the e-mail "john.doe@example", select the textfield so that it is in focus, connect a hardware keyboard and hit the "Enter" key. The page will now display the following exception: "This email address is badly formatted." because we are missing ".com" (or any TLD) behind our e-mail address.
image

Grammar side note

  • The error message "Account doesn't exist" ends the sentence without a period, but "This email address is badly formatted." does. Could be done better!

The issue

The exception message does not disappear even when the e-mail is corrected and has been sent off successfully. See image below.
image

Expected behavior

The exception message should not appear on this page:
image

Sample project

No sample project provided. Please use flutterfire_ui and have it working with e-mail auth. In my case, I used e-mail & password in this example.


Additional context

The issue can be resolved different ways. The bug lies in the following file: packages/flutterfire_ui/lib/src/auth/views/forgot_password_view.dart

Solution 1. Set exception to null

On line 52, in the file forgot_password_view.dart, the exception gets set but never cleared. A solution would be to write exception = null; on line 49.
image
Permalink:

Solution 2. Hide exception message when email has been sent

On line 87, the only condition to show the exception message is having one. We could add another condition such as exception != null && !emailSent.
image
Permalink:


@BrutalCoding BrutalCoding added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels May 30, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label May 31, 2022
@darshankawar
Copy link

Thanks for the detailed report. I was able to replicate this issue using plugin's example as below:

Screenshot 2022-05-31 at 4 07 37 PM

@darshankawar darshankawar added plugin: ui and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels May 31, 2022
@darshankawar
Copy link

/cc @lesnitsky

@lesnitsky lesnitsky self-assigned this Jun 1, 2022
@darshankawar darshankawar added the resolution: fixed A fix has been merged or is pending merge from a PR. label Dec 2, 2022
@firebase firebase locked and limited conversation to collaborators Jan 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: ui resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working
Projects
None yet
3 participants