diff --git a/packages/web-ui-registration/src/LoginForm.tsx b/packages/web-ui-registration/src/LoginForm.tsx
index 24ad530f50155..17a513b9b894a 100644
--- a/packages/web-ui-registration/src/LoginForm.tsx
+++ b/packages/web-ui-registration/src/LoginForm.tsx
@@ -73,15 +73,12 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute
},
onError: (error: any) => {
if ([error.error, error.errorType].includes('error-invalid-email')) {
- setError('username', { type: 'invalid-email', message: t('registration.page.login.errors.invalidEmail') });
+ return setError('username', { type: 'invalid-email', message: t('registration.page.login.errors.invalidEmail') });
}
if ('error' in error && error.error !== 403) {
- setErrorOnSubmit(error.error);
- return;
+ return setErrorOnSubmit(error.error);
}
-
- setErrorOnSubmit('user-not-found');
},
});
@@ -93,11 +90,15 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute
if (loginFormRef.current) {
loginFormRef.current.focus();
}
- }, [errorOnSubmit]);
+ }, []);
const renderErrorOnSubmit = (error: LoginErrors) => {
const { type, i18n } = LOGIN_SUBMIT_ERRORS[error];
- return