* Icon and IconName * Button and ButtonGroup * UserAvatar * AvatarGroup * Avatar * WizardLayout * Dialogs * EmptyScreen * showToast and TextField * Editor * Skeleton * Skeleton * TopBanner and showToast * Button again * more * perf: Remove app-store reference from @calcom/ui * more * Fixing types * Icon * Fixed casing * dropdown * more * Select * more * Badge * List * more * Divider * more * fix * fix type check * refactor * fix * fix * fix * fix * fix * fix * fix * fix type check * fix * fix * fix * fix * more * more * more * more * add index file to components/command * fix * fix * fix * fix imports * fix * fix * fix * fix * fix * fix * fix * fix build errors * fix build errors * fix --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
30 lines
827 B
TypeScript
30 lines
827 B
TypeScript
import React from "react";
|
|
import { useFormContext } from "react-hook-form";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Label, TextField } from "@calcom/ui/components/form";
|
|
|
|
export default function TwoFactor({ center = true }) {
|
|
const { t } = useLocale();
|
|
const methods = useFormContext();
|
|
|
|
return (
|
|
<div className={center ? "mx-auto !mt-0 max-w-sm" : "!mt-0 max-w-sm"}>
|
|
<Label className="mt-4">{t("backup_code")}</Label>
|
|
|
|
<p className="text-subtle mb-4 text-sm">{t("backup_code_instructions")}</p>
|
|
|
|
<TextField
|
|
id="backup-code"
|
|
label=""
|
|
defaultValue=""
|
|
placeholder="XXXXX-XXXXX"
|
|
minLength={10} // without dash
|
|
maxLength={11} // with dash
|
|
required
|
|
{...methods.register("backupCode")}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|