Skip to content

Commit 8af8418

Browse files
refactor(auth): single DISABLE_EMAIL_SIGNUP env var controls both ui and backend
1 parent 231cc34 commit 8af8418

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

apps/sim/app/(auth)/signup/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from 'next'
2-
import { isRegistrationDisabled } from '@/lib/core/config/feature-flags'
2+
import { isEmailSignupDisabled, isRegistrationDisabled } from '@/lib/core/config/feature-flags'
33
import { getOAuthProviderStatus } from '@/app/(auth)/components/oauth-provider-checker'
44
import SignupForm from '@/app/(auth)/signup/signup-form'
55

@@ -23,6 +23,7 @@ export default async function SignupPage() {
2323
googleAvailable={googleAvailable}
2424
microsoftAvailable={microsoftAvailable}
2525
isProduction={isProduction}
26+
emailSignupEnabled={!isEmailSignupDisabled}
2627
/>
2728
)
2829
}

apps/sim/app/(auth)/signup/signup-form.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ interface SignupFormProps {
7777
googleAvailable: boolean
7878
microsoftAvailable: boolean
7979
isProduction: boolean
80+
emailSignupEnabled: boolean
8081
}
8182

8283
function SignupFormContent({
8384
githubAvailable,
8485
googleAvailable,
8586
microsoftAvailable,
8687
isProduction,
88+
emailSignupEnabled,
8789
}: SignupFormProps) {
8890
const router = useRouter()
8991
const searchParams = useSearchParams()
@@ -354,8 +356,7 @@ function SignupFormContent({
354356

355357
const ssoEnabled = isTruthy(getEnv('NEXT_PUBLIC_SSO_ENABLED'))
356358
const emailEnabled =
357-
!isFalsy(getEnv('NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED')) &&
358-
!isTruthy(getEnv('NEXT_PUBLIC_DISABLE_EMAIL_SIGNUP'))
359+
!isFalsy(getEnv('NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED')) && emailSignupEnabled
359360
const hasSocial = githubAvailable || googleAvailable || microsoftAvailable
360361
const hasOnlySSO = ssoEnabled && !emailEnabled && !hasSocial
361362
const showBottomSection = hasSocial || (ssoEnabled && !hasOnlySSO)
@@ -615,6 +616,7 @@ export default function SignupPage({
615616
googleAvailable,
616617
microsoftAvailable,
617618
isProduction,
619+
emailSignupEnabled,
618620
}: SignupFormProps) {
619621
return (
620622
<Suspense fallback={<div className='flex h-screen items-center justify-center'>Loading…</div>}>
@@ -623,6 +625,7 @@ export default function SignupPage({
623625
googleAvailable={googleAvailable}
624626
microsoftAvailable={microsoftAvailable}
625627
isProduction={isProduction}
628+
emailSignupEnabled={emailSignupEnabled}
626629
/>
627630
</Suspense>
628631
)

apps/sim/lib/core/config/env.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ export const env = createEnv({
505505
NEXT_PUBLIC_DISABLE_PUBLIC_API: z.boolean().optional(), // Disable public API access UI toggle globally
506506
NEXT_PUBLIC_INBOX_ENABLED: z.boolean().optional(), // Enable inbox (Sim Mailer) on self-hosted
507507
NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED: z.boolean().optional().default(true), // Control visibility of email/password login forms
508-
NEXT_PUBLIC_DISABLE_EMAIL_SIGNUP: z.boolean().optional(), // Hide email/password form on /signup only (set alongside DISABLE_EMAIL_SIGNUP)
509508
NEXT_PUBLIC_TURNSTILE_SITE_KEY: z.string().min(1).optional(), // Cloudflare Turnstile site key for captcha widget
510509
},
511510

@@ -545,7 +544,6 @@ export const env = createEnv({
545544
NEXT_PUBLIC_DISABLE_PUBLIC_API: process.env.NEXT_PUBLIC_DISABLE_PUBLIC_API,
546545
NEXT_PUBLIC_INBOX_ENABLED: process.env.NEXT_PUBLIC_INBOX_ENABLED,
547546
NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED: process.env.NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED,
548-
NEXT_PUBLIC_DISABLE_EMAIL_SIGNUP: process.env.NEXT_PUBLIC_DISABLE_EMAIL_SIGNUP,
549547
NEXT_PUBLIC_TURNSTILE_SITE_KEY: process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY,
550548
NEXT_PUBLIC_E2B_ENABLED: process.env.NEXT_PUBLIC_E2B_ENABLED,
551549
NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALS: process.env.NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALS,

0 commit comments

Comments
 (0)