From 48c5f353ff4c3b89714d9f0753f7f56231e8b27f Mon Sep 17 00:00:00 2001 From: Developing-Gamer Date: Wed, 27 May 2026 13:35:41 -0700 Subject: [PATCH] Refine OTP and passkey sections in account settings. Co-authored-by: Cursor --- .../email-and-auth/otp-section.tsx | 7 +++++-- .../email-and-auth/passkey-section.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/otp-section.tsx b/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/otp-section.tsx index 4a3859bbd..2a9f7fbcf 100644 --- a/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/otp-section.tsx +++ b/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/otp-section.tsx @@ -44,8 +44,11 @@ function OtpSectionInner({ user }: { user: any }) { const hasValidEmail = contactChannels.filter((x: any) => (x.type as string) === 'email' && x.isVerified && x.usedForAuth).length > 0; const handleDisableOTP = async () => { - await user.update({ otpAuthEnabled: false }); - setDisabling(false); + try { + await user.update({ otpAuthEnabled: false }); + } finally { + setDisabling(false); + } }; return ( diff --git a/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/passkey-section.tsx b/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/passkey-section.tsx index 0f84301b2..d9afd4ef3 100644 --- a/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/passkey-section.tsx +++ b/apps/dashboard/src/components/dashboard-account-settings/email-and-auth/passkey-section.tsx @@ -11,6 +11,7 @@ export function PasskeySection(props?: { const isInMockMode = !!props?.mockMode; const user = useUser({ or: isInMockMode ? 'return-null' : "redirect" }); const stackApp = useStackApp(); + const project = stackApp.useProject(); // In mock mode, show a placeholder message if (isInMockMode && !user) { @@ -28,7 +29,6 @@ export function PasskeySection(props?: { return null; } - const project = stackApp.useProject(); if (!project.config.passkeyEnabled) { return null; }