feat: add backup code authentication for 2FA login

This commit is contained in:
Mauricio Siu
2025-02-20 01:50:01 -06:00
parent a9e12c2b18
commit 5a1145996d
2 changed files with 156 additions and 60 deletions

View File

@@ -35,6 +35,7 @@ type PasswordForm = z.infer<typeof PasswordSchema>;
export const Disable2FA = () => {
const utils = api.useUtils();
const [isOpen, setIsOpen] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const form = useForm<PasswordForm>({
@@ -72,7 +73,7 @@ export const Disable2FA = () => {
};
return (
<AlertDialog>
<AlertDialog open={isOpen} onOpenChange={setIsOpen}>
<AlertDialogTrigger asChild>
<Button variant="destructive">Disable 2FA</Button>
</AlertDialogTrigger>
@@ -116,6 +117,7 @@ export const Disable2FA = () => {
variant="outline"
onClick={() => {
form.reset();
setIsOpen(false);
}}
>
Cancel