Repository navigation
fix(auth): Preserve explicit invitation acceptance through MFA - #126028
Merged
evanpurkhiser merged 1 commit intoSep 30, 2026
Merged
evanpurkhiser merged 1 commit into
evanpurkhiser merged 1 commit into
Conversation
Let the composed invitation page keep invitations pending after MFA enrollment while preserving automatic acceptance for existing clients. Retain pending MFA challenges when the opted-in page is reloaded.
evanpurkhiser
force-pushed
the
git/fix-auth-preserve-explicit-invitation-acceptance-through-mfa
branch
from
September 30, 2026 14:24
a6813cf to
8fa04f9
Compare
cmanallen
approved these changes
Sep 30, 2026
| ) | ||
| auth.initiate_login(self.request, next_url=url) | ||
| # Reloading the composed page must preserve an in-progress MFA challenge. | ||
| if not (explicit_acceptance and auth.get_pending_2fa_user(request) is not None): |
Member
There was a problem hiding this comment.
This conditional is weird. if not explicit_acceptance or auth.get_pending_2fa_user(request) is None would be more readable. I believe the boolean logic is the same. If explicit_acceptance is off or there is no pending 2fa user continue through the conditional.
Member
Author
There was a problem hiding this comment.
I'll leave it as is for now, this code will be removed pretty fast
evanpurkhiser
enabled auto-merge (squash)
September 30, 2026 14:28
evanpurkhiser
deleted the
git/fix-auth-preserve-explicit-invitation-acceptance-through-mfa
branch
September 30, 2026 14:34
evanpurkhiser
added a commit
that referenced
this pull request
Sep 30, 2026
Move organization invitation acceptance under the branded authentication layout and compose the invitation account badge, account authentication, and status components introduced earlier in this stack. Signed-out users can create an account or sign in, including MFA, within the invitation screen. Authentication refreshes the invitation before presenting acceptance. Organization SSO accepts the invitation through the provider pipeline and lands in the organization. Signed-in users see the account they are accepting with and can switch accounts inline. `useInvitationFlow` owns fetching, authentication completion, account switching, acceptance, and the derived view state. The page renders that state with a shared `InvitationLayout`, while `getInvitationStep` selects the authentication or acceptance step independently of the status component. The invitation query opts into explicit acceptance. MFA enrollment in a separate tab leaves the invitation pending, and returning to the invitation refetches its requirements before offering acceptance. Temporary invitation, organization-config, and authentication-config failures show a retry action; invalid or expired invitations retain their account-switch action. A failed refresh after logout keeps the previous account hidden. Retain the legacy invitation component and its unit tests for a follow-up cleanup. Backend dependency: #126028 is merged and included in this stack’s base, so browser CI exercises the compatibility behavior. It preserves default automatic acceptance for existing clients while enabling explicit acceptance and preserving pending MFA challenges for this flow. Deploy that backend change before landing this frontend change. Verification: all eight browser acceptance journeys pass using the default auth configuration against that backend: signed-in acceptance, new-account registration, password sign-in, MFA sign-in, organization SSO, switching accounts and signing in again, refreshing during a pending MFA challenge, and required MFA enrollment in a second tab followed by returning and explicitly accepting without a page reload. Registration and sign-in assert the membership remains pending before acceptance. Page integration tests cover transient-load retries, organization-config retries, failed focus refreshes, and failed refreshes after logout. The scoped frontend suite has 39 passing tests; frontend type-checking and lint checks pass.
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.
Keep invitation acceptance compatible with the existing screen while the composed authentication flow rolls out.
Clients can opt in with
GET /api/0/accept-invite/{organization}/{member}/{token}/?acceptance=explicit. The opt-in is stored with the pending invitation in the session. MFA enrollment then leaves that invitation pending for an explicit acceptance POST. Clients using the default request retain automatic acceptance after enrollment. Session cleanup removes the opt-in, and loading another invitation with the default behavior resets it.The opted-in request also preserves a pending MFA login challenge when the invitation page is reloaded. Authentication and acceptance validation remain unchanged, and organization SSO continues to accept through its provider pipeline.
Deploy this backend change before the frontend opt-in in #125910.
Verification: 67 scoped backend tests pass, covering existing automatic acceptance, explicit TOTP/SMS/security-key enrollment, subsequent explicit acceptance, invalid invitations, session scoping, and pending MFA preservation. Backend typing and lint checks pass. The composed flow was also tested against this backend with all eight browser acceptance journeys passing.