diff --git a/frontend/src/components/auth/totp-form.tsx b/frontend/src/components/auth/totp-form.tsx index 60e5dbd..2be9216 100644 --- a/frontend/src/components/auth/totp-form.tsx +++ b/frontend/src/components/auth/totp-form.tsx @@ -14,11 +14,10 @@ import z from "zod"; interface Props { formId: string; onSubmit: (code: TotpSchema) => void; - loading?: boolean; } export const TotpForm = (props: Props) => { - const { formId, onSubmit, loading } = props; + const { formId, onSubmit } = props; const { t } = useTranslation(); z.config({ @@ -30,6 +29,14 @@ export const TotpForm = (props: Props) => { resolver: zodResolver(totpSchema), }); + const handleChange = (value: string) => { + form.setValue("code", value, { shouldDirty: true, shouldValidate: true }); + + if (value.length === 6) { + onSubmit({ code: value }); + } + }; + return (