Files
supabase/apps/studio/components/interfaces/Account/RecoveryInterstitial/RecoveryTaskRow.tsx
Danny White 749386567d feat(studio): fix recovery codes inside an interstitial (#52122)
## Problem

Users need to fix missing or exhausted recovery codes without leaving
the recovery reminder.

## Solution

Add a reusable recovery reminder and full-screen modal shell using the
existing recovery-code dialogs. Dismissal is a callback. The automatic
layout gate in #51643 mounts the UI; there is no standalone preview
route.

| State | Screenshot |
| --- | --- |
| Blocked request | <img width="654" height="800" alt="39307"
src="https://github.com/user-attachments/assets/2ba80ea7-24ad-4d29-ab50-730890501014"
/> |
| Recovery codes used up | <img width="654" height="800" alt="Supabase"
src="https://github.com/user-attachments/assets/5dd63735-1254-4855-bbd8-04c2e4c699fa"
/> |
| No recovery codes | <img width="654" height="800" alt="Supabase"
src="https://github.com/user-attachments/assets/58ff5b91-7da6-4c39-ad99-cea7cce8cf73"
/> |
| Recovery codes saved (just completed above _Generate codes_ step) |
<img width="654" height="800" alt="63500"
src="https://github.com/user-attachments/assets/1fc7ca56-a7cb-4edd-a3cd-4d8cf5c09659"
/> |


## Review instructions

**This PR’s own deploy preview cannot show the takeover.** Review its
diff here, but test the assembled stack on [#51643’s staging
preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations).
The controller only mounts in #51643.

Before each scenario: use a non-SSO staging test account with MFA
verified; check `enableAccountRecoveryInterstitial` and
`enableAuthRecoveryCodes` are both true in the staging dev toolbar, then
close the toolbar and other dialogs. Clear
`account-recovery-reminder:<userId>` from DevTools Application → Local
Storage **for that preview origin**, then reload the dashboard.

1. **Exhausted codes:** use an account with existing codes and exactly
one verified authenticator. In DevTools Network, right-click GET
`/factors/recovery-codes` → **Override content**. Keep the JSON fields,
set `remaining` to `0`, save and reload. Confirm the request shows the
overridden response and the takeover opens.
2. **Missing codes, separate scenario:** disable overrides and use an
MFA test account with no generated codes. Clear snooze and reload.
Setting `remaining` to `0` simulates exhausted codes, not missing codes.
3. Disable overrides before live actions. Cancel regeneration to check
existing codes remain intact, then generate or regenerate codes and
acknowledge storage. These actions change the test account. Continue or
Skip should reveal the unchanged URL and page.
2026-10-27 12:29:10 +11:00

38 lines
991 B
TypeScript

import { CheckIcon } from 'lucide-react'
import { ReactNode } from 'react'
import { Button, CardContent } from 'ui'
export const RecoveryTaskRow = ({
title,
description,
isComplete,
children,
}: {
title: string
description: string
isComplete: boolean
children: ReactNode
}) => (
<CardContent className="flex flex-col gap-x-8 gap-y-4 px-6 py-5 sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1 space-y-0.5">
<div className="flex flex-wrap items-center gap-2">
<h2 className="text-sm font-medium">{title}</h2>
</div>
<p className="text-sm text-foreground-lighter">{description}</p>
</div>
<div className="w-32 shrink-0 [&_button]:w-full">
{isComplete && (
<Button
variant="default"
size="tiny"
disabled
icon={<CheckIcon size={14} aria-hidden="true" />}
>
Done
</Button>
)}
{children}
</div>
</CardContent>
)