diff --git a/frontend/src/pages/login-page.tsx b/frontend/src/pages/login-page.tsx index 91478e6c..b47b1842 100644 --- a/frontend/src/pages/login-page.tsx +++ b/frontend/src/pages/login-page.tsx @@ -122,7 +122,11 @@ export const LoginPage = () => { }, }); - const { mutate: loginMutate, isPending: loginIsPending } = useMutation({ + const { + mutate: loginMutate, + isPending: loginIsPending, + isSuccess: loginIsSuccess, + } = useMutation({ mutationFn: (values: LoginSchema) => axios.post("/api/user/login", values), mutationKey: ["login"], onSuccess: (data) => { @@ -309,7 +313,10 @@ export const LoginPage = () => { )} {userAuthConfigured && ( loginMutate(values)} + onSubmit={(values) => { + if (loginIsPending || loginIsSuccess) return; + loginMutate(values); + }} loading={loginIsPending || oauthIsPending} formId={formId} params={(() => { diff --git a/frontend/src/pages/totp-page.tsx b/frontend/src/pages/totp-page.tsx index 3b9a6ef7..209194de 100644 --- a/frontend/src/pages/totp-page.tsx +++ b/frontend/src/pages/totp-page.tsx @@ -87,7 +87,10 @@ export const TotpPage = () => { totpMutation.mutate(values)} + onSubmit={(values) => { + if (totpMutation.isPending || totpMutation.isSuccess) return; + totpMutation.mutate(values); + }} />