Skip to content

Conversation

@vpomerleau
Copy link
Contributor

@vpomerleau vpomerleau commented Oct 31, 2025

Because

  • We were seeing some AAL errors on createTotp

This pull request

  • Ensure that inline_totp_setup waits for totp status to resolve before starting setup process
  • Add a few more navigation intercepts to navigate to signin_totp_code instead of inline_totp_setup if totp already enabled
  • Add a couple of tests for inline_totp_setup

Issue that this pull request solves

Closes: FXA-12681

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

This is to address some edge cases where users may land on inline_totp_setup when they already have 2FA enabled.

@vpomerleau vpomerleau marked this pull request as ready for review November 17, 2025 23:40
@vpomerleau vpomerleau requested a review from a team as a code owner November 17, 2025 23:40
@vpomerleau vpomerleau force-pushed the polish-totp-navigation branch from bc0eb89 to 9d37fc9 Compare November 17, 2025 23:46
@MagentaManifold MagentaManifold self-assigned this Nov 19, 2025
Copy link
Contributor

@MagentaManifold MagentaManifold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how to actually test these, but the logic and the unit tests you added look solid. I added a comment for potentially making the logic simpler

totpStatus?.account?.totp.verified === true ||
isTotpCreating.current
isTotpCreating.current ||
totpStatusLoading === true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: totpStatusLoading is a boolean, so there's no need for === true. The other occurrence on line 175 in the same file is probably a mistake

const handleOAuthRedirectError = async (error: AuthError) => {
if (
error.errno === AuthUiErrors.TOTP_REQUIRED.errno ||
error.errno === AuthUiErrors.INSUFFICIENT_ACR_VALUES.errno
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my understanding is correct (lmk if I'm wrong): TOTP_REQUIRED means TOTP is not enabled (but should be), while INSUFFICIENT_ACR_VALUES means TOTP is enabled, but the user doesn't have a session with this ACR (i.e., AAL2). So we can distinguish the two cases just by handling these two errnos separately, saving us an API call. Ditto for Signin/utils.ts

Because:

* We were seeing some AAL errors on createTotp

This commit:

* Ensure that inline_totp_setup waitf totp status to resolve before starting setup process
* Add a few more navigation intercepts to navigate to signin_totp_code instead of inline_totp_setup if totp already enabled
* Add a couple of tests for inline_totp_setup

Closes
@vpomerleau vpomerleau force-pushed the polish-totp-navigation branch from 9d37fc9 to b0ff926 Compare November 19, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants