Skip to content

refactor(auth): clarify 2FA state handling in TwoFactorAuth Manager#60736

Draft
joshtrichards wants to merge 11 commits into
masterfrom
jtr/refactor-2fa-Manager
Draft

refactor(auth): clarify 2FA state handling in TwoFactorAuth Manager#60736
joshtrichards wants to merge 11 commits into
masterfrom
jtr/refactor-2fa-Manager

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

Summary

Refactor TwoFactorAuth\Manager to make 2FA login-state handling more explicit and maintainable.

Changes

  • clarify needsSecondFactor() with dedicated helpers for pending, satisfied, and stale state
  • extract success/failure side effects from verifyChallenge()
  • centralize the login_token_2fa config key
  • improve internal naming and inline documentation

Motivation

This keeps the existing flow easier to reason about and prepares the class for future cleanup around explicit 2FA state tracking. i.e. #39411

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…ted()

Signed-off-by: Josh <josh.t.richards@gmail.com>
…ctions

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
…into helpers

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
…actorLogin()

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
…orPending overlap

- Refactor overlap
- Clarify separate concerns
- Re-order together within class

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added 2. developing Work in progress feature: authentication technical debt 🧱 🤔🚀 ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress feature: authentication ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant