fix(auth): reset MfaEnrollmentScreen to a clean flow after successful enrollment - #2463
fix(auth): reset MfaEnrollmentScreen to a clean flow after successful enrollment#2463demolaf wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a state reset mechanism to the MFA enrollment screen upon successful enrollment, resetting it back to the SelectFactor step and clearing consumed inputs before invoking onComplete. To prevent the UI from prematurely resetting during the back-stack pop transition, a MfaEnrollmentDestination wrapper with a RetainedMfaEnrollmentState has been introduced to freeze and retain the completed state during the transition. Additionally, single-factor auto-advance is now suppressed after a completed enrollment to avoid re-triggering the flow upon state restoration. Comprehensive unit tests have been added to verify these behaviors. I have no feedback to provide as there are no review comments.
ab4f6dd to
f3f02fd
Compare
f3f02fd to
ce24ffa
Compare
After a successful enrollment
MfaEnrollmentScreeninvokedonComplete()but leftcurrentSteponVerifyFactorwithverificationCodestill populated, so a caller embedding the screen directly and not navigating away sat on a filled form whose Verify button re-submitted an already-consumed code.FirebaseAuthScreenpops the back stack on completion, which is why this never surfaced through the default host.The screen now resets to
SelectFactorand clears all consumed input before invokingonComplete. A latch on the single-factor auto-advance stops a configuration change after success from restoring the reset step and immediately re-entering enrollment for a factor the user already has.FirebaseAuthScreenretains the completed state for the duration of its exit transition, so the destination no longer turns into the factor picker mid-fade.Added tests covering the reset on the SMS and TOTP paths, the latch across a state restoration, and the destination retention — each verified to fail against the unfixed code.
Maintainer note: Fixes internal CPRN-384