Uh oh!
There was an error while loading. Please reload this page.
fix(auth): clear leftover MFA enrollment state after #2473's reset-on-entry - #2477
Open
demolaf wants to merge 3 commits into
Open
fix(auth): clear leftover MFA enrollment state after #2473's reset-on-entry#2477demolaf wants to merge 3 commits into
demolaf wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request prevents state resets and duplicate entries when navigating within the MFA enrollment flow, particularly addressing issues with second taps and un-hosted screens. It introduces a guard to prevent re-entry when a flow step is already on the stack, resets the flow state on completion for un-hosted screens, and adds comprehensive tests covering these scenarios. The reviewer suggests reusing the existing mfaEnrollmentStartStep function in unhostedStartStep to reduce code duplication and improve maintainability.
Uh oh!
There was an error while loading. Please reload this page.
demolaf
marked this pull request as ready for review
September 4, 2026 12:36
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 freeto 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.
#2473 clears
MfaEnrollmentFlowStateon entry to the flow. Two paths do not reach an entry.Un-hosted
MfaEnrollmentScreen. Driven without a host it owns its step and remembers its ownflow state, which nothing outside it can reset.
onComplete()cleared onlyerrorandlastException, so a caller that stays composed goes on showingVerifyFactorwith the enrollednumber and code. It now resets and returns to its start step — the single allowed factor's
configure step, or the picker. Hosted is untouched. This flips two existing assertions that pinned
"does not navigate away on success", which is the behaviour being changed.
Entry from inside the flow. Both host call sites live on the success destination, which stays
composed while the push runs, so a second tap could reset the enrolment in progress rather than the
previous one.
enterMfaEnrollmentis now a no-op when a step of the flow is already on the stack,which also enforces the
pushUniqueinvariant that was previously only asserted in a comment.Adds 5 tests: the un-hosted reset on both the single-factor and picker starts, re-entry from inside
the flow through both host call sites, and sign-out → second user. Each was verified to fail with
the product change reverted.
Maintainer note: Fixes internal CPRN-405