From f7f756d285e401a15d0ac9e34f02a97b64768e1c Mon Sep 17 00:00:00 2001 From: vamsikrishnamathala Date: Fri, 16 Jan 2026 15:10:41 +0530 Subject: [PATCH] fix: magic code sign-in --- apps/space/core/components/account/auth-forms/auth-root.tsx | 5 +++-- apps/space/core/types/auth.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) 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; }