Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update check-account-exists.ts

Kiran K5efa2e115d26
diff --git a/apps/web/lib/actions/check-account-exists.ts b/apps/web/lib/actions/check-account-exists.ts
index 7f458d4f21..16bb81931f 100644
--- a/apps/web/lib/actions/check-account-exists.ts
+++ b/apps/web/lib/actions/check-account-exists.ts
@@ -30,13 +30,12 @@ export const checkAccountExistsAction = actionClient
}
// Check SAML enforcement
- const hostname = new URL(process.env.NEXTAUTH_URL as string).hostname;
const emailDomain = email.split("@")[1];
- const shouldCheckSAML = APP_HOSTNAMES.has(hostname) && !isGenericEmail(emailDomain);
+ const hostname = new URL(process.env.NEXTAUTH_URL as string).hostname;
+ const shouldCheckSAML =
+ APP_HOSTNAMES.has(hostname) && !isGenericEmail(emailDomain);
- // Run both queries in parallel
const [user, workspace] = await Promise.all([
- // Find the user
prisma.user.findUnique({
where: {
email,
@@ -45,7 +44,7 @@ export const checkAccountExistsAction = actionClient
passwordHash: true,
},
}),
- // Check SAML enforcement (only if needed)
+
shouldCheckSAML
? prisma.project.findUnique({
where: {
@@ -58,17 +57,9 @@ export const checkAccountExistsAction = actionClient
: Promise.resolve(null),
]);
- if (workspace?.ssoEnforcedAt) {
- return {
- accountExists: !!user,
- hasPassword: !!user?.passwordHash,
- requireSAML: true,
- };
- }
-
return {
accountExists: !!user,
hasPassword: !!user?.passwordHash,
- requireSAML: false,
+ requireSAML: !!workspace?.ssoEnforcedAt,
};
});