diff --git a/packages/elements-react/src/components/form/form.tsx b/packages/elements-react/src/components/form/form.tsx index 2103224e..5dc6f723 100644 --- a/packages/elements-react/src/components/form/form.tsx +++ b/packages/elements-react/src/components/form/form.tsx @@ -343,7 +343,12 @@ export function OryForm({ children, onAfterSubmit }: OryFormProps) { break } } - methods.setValue("password", "") + if ("password" in data) { + methods.setValue("password", "") + } + if ("code" in data) { + methods.setValue("code", "") + } onAfterSubmit?.(data.method) }