Skip to content

ref(forms): Migrate account security 2FA enrollment off JsonForm to scraps form - #119188

Draft
priscilawebdev wants to merge 1 commit into
masterfrom
pri/ref-forms-migrate-account-security-enroll
Draft

ref(forms): Migrate account security 2FA enrollment off JsonForm to scraps form#119188
priscilawebdev wants to merge 1 commit into
masterfrom
pri/ref-forms-migrate-account-security-enroll

Conversation

@priscilawebdev

Copy link
Copy Markdown
Member

Summary

Migrates the account security 2FA/MFA enrollment form (accountSecurityEnroll.tsx) from the legacy JsonForm/FormModel/sentry/components/forms system to the new scraps form system (@sentry/scraps/form).

Part of the ongoing JsonForm -> scraps form migration.

What changed

  • Replaced the single server-driven Form + JsonForm + FormModel with three focused scraps useScrapsForm components — one per authenticator type (TotpEnrollForm, SmsEnrollForm, U2fEnrollForm) — dispatched by authenticator.id.
  • All enrollment behavior is preserved:
    • TOTP: QR code, copyable authenticator secret, OTP field, Confirm submit (POST {otp, secret}).
    • SMS: two-step send-code / verify-OTP flow, phone disabling after send, Start Over reset + refetch, loading/success/error toasts, form reset on error.
    • U2F: WebAuthn enrollment + device name field, Confirm submit.
    • Whole-page loading indicator during TOTP/U2F submit, Already enrolled redirect, relocation org-subdomain redirect, remove-authenticator confirm.
  • Server-provided field labels/defaults are still read from authenticator.form, so copy is unchanged.
  • Refactored WebAuthnEnroll (only consumer is this view) to be form-agnostic: it now reports the attestation result via an onEnroll callback instead of mutating a legacy FormModel.
  • Mutations use useMutation + fetchMutation with the mutationFn payload typed (no call-site generics).

Form search

This form is not registered in SettingsSearch (no src/sentry/data/forms entry; fields are server-driven on a dynamic route), so no FormSearch wrapper or field-registry regeneration is needed.

Testing

  • pnpm run typecheck (whole project) passes
  • pnpm run lint:js passes for changed files
  • pnpm test-ci accountSecurityEnroll.spec.tsx passes (5/5)

No customer information is included in this change.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.92% 93.93% 🟢 +0.01%
Typed 134,398 134,433 🟢 +35
Untyped 8,697 8,680 🟢 -17
🔍 2 new type safety issues introduced

any-typed symbols (2 new)

File Line Detail
static/app/views/settings/account/accountSecurity/accountSecurityEnroll.tsx 73 label (var)
static/app/views/settings/account/accountSecurity/accountSecurityEnroll.tsx 78 defaultValue (var)

This is informational only and does not block the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant