import React, { useEffect, useState } from "react"; import useDigitInput from "react-digit-input"; import { useFormContext } from "react-hook-form"; import { useLocale } from "@lib/hooks/useLocale"; import { Input } from "@components/form/fields"; export default function TwoFactor() { const [value, onChange] = useState(""); const { t } = useLocale(); const methods = useFormContext(); const digits = useDigitInput({ acceptedCharacters: /^[0-9]$/, length: 6, value, onChange, }); useEffect(() => { if (value) methods.setValue("totpCode", value); // eslint-disable-next-line react-hooks/exhaustive-deps }, [value]); const className = "h-12 w-12 !text-xl text-center"; return (

{t("2fa_enabled_instructions")}

); }