fix(emulator): don't clear email when unlinking password provider#10524
Open
swseverance wants to merge 1 commit into
Open
fix(emulator): don't clear email when unlinking password provider#10524swseverance wants to merge 1 commit into
swseverance wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request modifies the Auth emulator to ensure that email-related information, including the email address, verification status, and email link sign-in preference, is retained when the password provider is deleted. Previously, these fields were explicitly cleared during the provider removal process. A new test case has been added to verify that an account's email remains registered and unavailable for new sign-ups after the password attribute is removed. I have no feedback to provide as there were no review comments to evaluate.
Unlinking the password provider was incorrectly clearing email, emailVerified, and emailLinkSignin. This caused users to display in the auth dashboard without an email. The behaviour also differed from prod firebase behavior in that it was possible to sign a user up, unlink the password provider, and then sign the user up again using the same email address. In prod this generates a 400 response. Resolves firebase#10517
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unlinking the password provider was incorrectly clearing email, emailVerified, and emailLinkSignin. This caused users to display in the auth dashboard without an email. The behaviour also differed from prod firebase behavior in that it was possible to sign a user up, unlink the password provider, and then sign the user up again using the same email address. In prod this generates a 400 response.
Resolves #10517
Description
Fixing a bug in the auth emulator described above
Scenarios Tested
In prod firebase:
auth.createUserWithEmailAndPassword(email, password)user.unlink("password")auth.createUserWithEmailAndPassword(email, password)(with same email as step 1).{ "error": { "code": 400, "message": "EMAIL_EXISTS", "errors": [ { "message": "EMAIL_EXISTS", "domain": "global", "reason": "invalid" } ] } }In local firebase (on this branch):
auth.createUserWithEmailAndPassword(email, password)user.unlink("password")auth.createUserWithEmailAndPassword(email, password)(with same email as step 1).{ "error": { "code": 400, "message": "EMAIL_EXISTS", "errors": [ { "message": "EMAIL_EXISTS", "reason": "invalid", "domain": "global" } ] } }The behavior of the emulator now aligns with production firebase. Previously the emulator would allow you to sign a user up with email and password, unlink the password provider, then sign a user up with email and password using the same email as before.
Sample Commands
N/A