Repository navigation
fix(ui): show setup-MFA backup codes before the next session task - #1083
Merged
Merged
Conversation
Three of the six tests fail here. The task calls onAuthComplete as soon as the session stops requiring MFA, which is before the user has seen the backup codes that the enrollment returned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…letes SessionTaskMfaView called onAuthComplete as soon as the session stopped requiring MFA. The response that enables the second factor is also the one that carries the backup codes, so the task completed while the code step or the phone number step was still on screen, and the app left AuthView before the backup codes step could show. The task now completes when MFA is set up and the flow would otherwise go back to the method list, which is where every step goes when it ends. A step that is still open keeps the screen: a verification that returns backup codes shows them, and closing them completes the task. onAuthComplete is called once, however many times they are closed. System back on the backup codes closes them the same way. Without that it popped the task off AuthView's back stack and left the sign-in screen up over an active session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ompletes UserButton closed the dialog it opens for a session that must set up MFA as soon as the session stopped requiring MFA. That is the moment the backup codes arrive, so the dialog closed before they could show. AuthView already closes the dialog through onAuthComplete. The effect now closes it only when the session is gone, which keeps a sign-out inside the dialog from leaving the sign-in screen up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ackup codes The pending-task router pushed choose-organization as soon as the response that enables the second factor changed the session, so the MFA view never showed its backup codes. The router now leaves the MFA task on top, and the MFA entry hands off through AuthState once the user closes the codes, which continues to the next pending task or completes auth. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152AP8LYmzdGZ7prbS9nKZV
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Collaborator
|
AuthView no longer pushes the next session task over SessionTaskMfaView, so the MFA view has to exit on its own. It only did that from the method list. If the task went away while the authenticator setup, phone number or code entry step was showing (MFA set up on another device), the user stayed on that step. The view now completes the task from any step once the session no longer requires MFA, except while the backup codes are showing or while this device's own enrollment request is still in flight. That request is the one whose response removes the task and carries the backup codes, so the step stays until the codes arrive.
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.
Requested via Slack thread
Before: with both
setup-mfaandchoose-organizationpending, the response that enables the second factor changes the session.ObservePendingSessionTaskRoutingreacts to that by pushing choose-organization on top ofSessionTaskMfaView, so the backup codes step never shows.After: the MFA task stays on screen until the user closes the backup codes. Closing them then continues to choose-organization, or completes auth if nothing else is pending.
How:
authNavigationCommandno longer pushes a pending task overAuthDestination.SessionTaskMfa, because that view owns its own exit. The MFA entry inAuthViewnow finishes throughAuthState.handleSessionTaskCompletion, the same hand-off the organization and reset-password tasks use, instead of callingonAuthCompletedirectly. That replaces the MFA destination with the next pending task, or completes auth when there is none. Adds a routing test for the MFA-on-top, org-pending case.Because the MFA view now owns its exit, it also exits when the task goes away from any step, not only the method list. If MFA is set up on another device while the authenticator setup, phone number or code entry step is showing, the view hands off right away. It stays only while the backup codes are showing or while this device's own enrollment request is in flight, since that response is what removes the task and carries the codes.
UserButton: the setup-MFA dialog it opens for a
ForcedMfasession now shows choose-organization inside the dialog after the backup codes are closed, instead of closing the dialog.Tests:
SessionTaskMfaViewTestcovers MFA set up elsewhere during the authenticator setup and code entry steps.AuthViewMfaBackupCodesTestruns the wholeAuthView: setup-mfa, then backup codes, close, then choose-organization, withonAuthCompletenot called.Fixes #1081
Linear: MOBILE-666
🤖 Generated with Claude Code
https://claude.ai/code/session_0152AP8LYmzdGZ7prbS9nKZV
Generated by Claude Code