From c92b8e1c792208b1d9b36b6b7d92c9721bc54bc6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Svanstr=C3=B6m?= Date: Tue, 19 Nov 2024 08:13:55 +0000 Subject: [PATCH] Fix presubmit in login --- applications/account/src/app/login/LoginContainer.tsx | 2 +- applications/account/src/app/login/LoginForm.tsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/applications/account/src/app/login/LoginContainer.tsx b/applications/account/src/app/login/LoginContainer.tsx index 7e3c81360d..8f9314d9b4 100644 --- a/applications/account/src/app/login/LoginContainer.tsx +++ b/applications/account/src/app/login/LoginContainer.tsx @@ -268,9 +268,9 @@ const LoginContainer = ({ onChangeAuthType={(authType) => { setAuthType(authType); }} + onPreSubmit={onPreSubmit} onSubmit={async (data) => { try { - await onPreSubmit?.(); const validateFlow = createFlow(); const result = await handleNextLogin({ api: silentApi, diff --git a/applications/account/src/app/login/LoginForm.tsx b/applications/account/src/app/login/LoginForm.tsx index a40ece65d2..9ad4cbac74 100644 --- a/applications/account/src/app/login/LoginForm.tsx +++ b/applications/account/src/app/login/LoginForm.tsx @@ -64,6 +64,7 @@ interface Props { payload: ChallengeResult; path?: string; }) => Promise; + onPreSubmit?: () => Promise; signInText?: string; externalSSO: { enabled?: boolean; @@ -91,6 +92,7 @@ const LoginForm = ({ authType, onChangeAuthType, onSubmit, + onPreSubmit, defaultUsername = '', signInText = c('Action').t`Sign in`, hasRemember, @@ -190,6 +192,7 @@ const LoginForm = ({ let ssoInfoResponse: SSOInfoResponse | undefined; try { + await onPreSubmit?.(); await startUnAuthFlow(); ssoInfoResponse = await api(getInfo({ username, intent: 'SSO' })); } catch (e) { @@ -242,6 +245,7 @@ const LoginForm = ({ let result: Unwrap>; try { + await onPreSubmit?.(); await startUnAuthFlow(); result = await handleLogin({ username, -- 2.11.4.GIT