Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useMutation } from '@tanstack/react-query';
import { fetch } from '@tauri-apps/plugin-http';
import { error } from '@tauri-apps/plugin-log';
import { isUndefined } from 'lodash-es';
import { useCallback, useEffect, useMemo, useState } from 'react';
import AuthCode from 'react-auth-code-input';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import AuthCode, { type AuthCodeRef } from 'react-auth-code-input';
import { type SubmitHandler, useForm } from 'react-hook-form';
import ReactMarkdown from 'react-markdown';
import { z } from 'zod';
Expand Down Expand Up @@ -584,6 +584,7 @@ const MFACodeForm = ({ description, token, proxyUrl, resetState }: MFACodeForm)
const closeModal = useMFAModal((state) => state.close);

const [mfaError, setMFAError] = useState('');
const authCodeRef = useRef<AuthCodeRef>(null);

const localLL = LL.modals.mfa.authentication;
const platformInfo = useClientStore((state) => state.platformInfo);
Expand Down Expand Up @@ -642,6 +643,7 @@ const MFACodeForm = ({ description, token, proxyUrl, resetState }: MFACodeForm)
}

setMFAError(message);
authCodeRef.current?.clear();
error(
`MFA code finish failed for location ${location?.id}. Response: ${JSON.stringify(data)}`,
);
Expand Down Expand Up @@ -678,6 +680,7 @@ const MFACodeForm = ({ description, token, proxyUrl, resetState }: MFACodeForm)
</div>
<form onSubmit={handleSubmit(handleValidSubmit)}>
<AuthCode
ref={authCodeRef}
length={CODE_LENGTH}
allowedCharacters="numeric"
containerClassName="mfa-code-container"
Expand Down
Loading