diff --git a/apps/space/core/components/account/auth-forms/auth-root.tsx b/apps/space/core/components/account/auth-forms/auth-root.tsx index e313cce893a..4c54e947c35 100644 --- a/apps/space/core/components/account/auth-forms/auth-root.tsx +++ b/apps/space/core/components/account/auth-forms/auth-root.tsx @@ -98,7 +98,7 @@ export const AuthRoot = observer(function AuthRoot() { } if (currentAuthMode === EAuthModes.SIGN_IN) { - if (response.is_password_autoset && isSMTPConfigured && isMagicLoginEnabled) { + if (isSMTPConfigured && isMagicLoginEnabled && response.status === "MAGIC_CODE") { setAuthStep(EAuthSteps.UNIQUE_CODE); generateEmailUniqueCode(data.email); } else if (isEmailPasswordEnabled) { @@ -109,7 +109,7 @@ export const AuthRoot = observer(function AuthRoot() { setErrorInfo(errorhandler); } } else { - if (isSMTPConfigured && isMagicLoginEnabled) { + if (isSMTPConfigured && isMagicLoginEnabled && response.status === "MAGIC_CODE") { setAuthStep(EAuthSteps.UNIQUE_CODE); generateEmailUniqueCode(data.email); } else if (isEmailPasswordEnabled) { @@ -119,6 +119,7 @@ export const AuthRoot = observer(function AuthRoot() { setErrorInfo(errorhandler); } } + return; }) .catch((error) => { const errorhandler = authErrorHandler(error?.error_code?.toString(), data?.email || undefined); diff --git a/apps/space/core/types/auth.ts b/apps/space/core/types/auth.ts index 19a616871ed..45e501ba4f1 100644 --- a/apps/space/core/types/auth.ts +++ b/apps/space/core/types/auth.ts @@ -19,6 +19,7 @@ export interface IEmailCheckData { } export interface IEmailCheckResponse { + status: "MAGIC_CODE" | "CREDENTIAL"; is_password_autoset: boolean; existing: boolean; }