From c2d8b08299c1f624bc091fd4b4c1b4cb49b7cdb4 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Thu, 17 Sep 2026 09:36:19 +0200 Subject: [PATCH] MFA Recovery codes: UI tweaks (#50488) ## What kind of change does this PR introduce? Admonition is not the right UI to tell users how many are still available. ## What is the current behavior? No recovery codes yet: image After: image ## What is the new behavior? No recovery codes yet: image After: image When low number of codes available: image ## Summary by CodeRabbit - **Improvements** - Recovery codes now appear in a dedicated section when enabled, separate from multi-factor authentication settings. - Recovery-code status updates are announced to screen readers for improved accessibility. - Available recovery codes are displayed in a clearer card-based layout once status information is available. --- .../interfaces/Account/TOTPFactors/index.tsx | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx b/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx index 2f15dde1656..07656cbe0b9 100644 --- a/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx +++ b/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx @@ -2,7 +2,7 @@ import { useFlag } from 'common' import dayjs from 'dayjs' import { Plus } from 'lucide-react' import { useState } from 'react' -import { Button, Card, CardContent } from 'ui' +import { Button, Card, CardContent, cn } from 'ui' import { Admonition } from 'ui-patterns/Admonition' import { PageSection, @@ -44,6 +44,41 @@ export const TOTPFactors = () => { return ( <> + {enableAuthRecoveryCodes && ( + + + + Recovery codes + + Recovery codes allow you to recover your account in case you lost access to your MFA + apps. + + + + + {recoveryCodesStatus?.status === 'unenrolled' && } + {recoveryCodesStatus?.status === 'available' && recoveryCodesStatus?.data && ( + + +

+ {recoveryCodesStatus.data.remaining}/{recoveryCodesStatus.data.total} recovery + codes available +

+
+ + {IS_STAGING_OR_LOCAL && } +
+
+
+ )} +
+
+ )} @@ -62,20 +97,6 @@ export const TOTPFactors = () => { )} - {recoveryCodesStatus?.status === 'unenrolled' && } - {recoveryCodesStatus?.status === 'available' && ( - - - {IS_STAGING_OR_LOCAL && } - - } - /> - )} {shouldShowLockoutWarning && (