diff --git a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx index cb4cd60e1..d7a8f6553 100644 --- a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx +++ b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx @@ -150,8 +150,10 @@ export const EnableAuthenticatorAppDialog = ({ }; useEffect(() => { - // Reset the form when the Dialog open state changes - setupTwoFactorAuthenticationForm.reset(); + // Reset the form when the Dialog closes + if (!open) { + setupTwoFactorAuthenticationForm.reset(); + } }, [open, setupTwoFactorAuthenticationForm]); return ( diff --git a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx index 2a83e6499..48e343e8d 100644 --- a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx +++ b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx @@ -93,8 +93,10 @@ export const ViewRecoveryCodesDialog = ({ open, onOpenChange }: ViewRecoveryCode }; useEffect(() => { - // Reset the form when the Dialog open state changes - viewRecoveryCodesForm.reset(); + // Reset the form when the Dialog closes + if (!open) { + viewRecoveryCodesForm.reset(); + } }, [open, viewRecoveryCodesForm]); return (