@@ -75,10 +75,18 @@ const validateEmailField = (emailValue: string): string[] => {
7575interface SignupFormProps {
7676 githubAvailable : boolean
7777 googleAvailable : boolean
78+ microsoftAvailable : boolean
7879 isProduction : boolean
80+ emailSignupEnabled : boolean
7981}
8082
81- function SignupFormContent ( { githubAvailable, googleAvailable, isProduction } : SignupFormProps ) {
83+ function SignupFormContent ( {
84+ githubAvailable,
85+ googleAvailable,
86+ microsoftAvailable,
87+ isProduction,
88+ emailSignupEnabled,
89+ } : SignupFormProps ) {
8290 const router = useRouter ( )
8391 const searchParams = useSearchParams ( )
8492 const { refetch : refetchSession } = useSession ( )
@@ -346,6 +354,14 @@ function SignupFormContent({ githubAvailable, googleAvailable, isProduction }: S
346354 }
347355 }
348356
357+ const ssoEnabled = isTruthy ( getEnv ( 'NEXT_PUBLIC_SSO_ENABLED' ) )
358+ const emailEnabled =
359+ ! isFalsy ( getEnv ( 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' ) ) && emailSignupEnabled
360+ const hasSocial = githubAvailable || googleAvailable || microsoftAvailable
361+ const hasOnlySSO = ssoEnabled && ! emailEnabled && ! hasSocial
362+ const showBottomSection = hasSocial || ( ssoEnabled && ! hasOnlySSO )
363+ const showDivider = ( emailEnabled || hasOnlySSO ) && showBottomSection
364+
349365 return (
350366 < >
351367 < div className = 'space-y-1 text-center' >
@@ -357,21 +373,13 @@ function SignupFormContent({ githubAvailable, googleAvailable, isProduction }: S
357373 </ p >
358374 </ div >
359375
360- { /* SSO Login Button (primary top-only when it is the only method) */ }
361- { ( ( ) => {
362- const ssoEnabled = isTruthy ( getEnv ( 'NEXT_PUBLIC_SSO_ENABLED' ) )
363- const emailEnabled = ! isFalsy ( getEnv ( 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' ) )
364- const hasSocial = githubAvailable || googleAvailable
365- const hasOnlySSO = ssoEnabled && ! emailEnabled && ! hasSocial
366- return hasOnlySSO
367- } ) ( ) && (
376+ { hasOnlySSO && (
368377 < div className = 'mt-8' >
369378 < SSOLoginButton callbackURL = { redirectUrl || '/workspace' } variant = 'primary' />
370379 </ div >
371380 ) }
372381
373- { /* Email/Password Form - show unless explicitly disabled */ }
374- { ! isFalsy ( getEnv ( 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' ) ) && (
382+ { emailEnabled && (
375383 < form onSubmit = { onSubmit } className = 'mt-8 space-y-10' >
376384 < div className = 'space-y-6' >
377385 < div className = 'space-y-2' >
@@ -540,16 +548,7 @@ function SignupFormContent({ githubAvailable, googleAvailable, isProduction }: S
540548 </ form >
541549 ) }
542550
543- { /* Divider - show when we have multiple auth methods */ }
544- { ( ( ) => {
545- const ssoEnabled = isTruthy ( getEnv ( 'NEXT_PUBLIC_SSO_ENABLED' ) )
546- const emailEnabled = ! isFalsy ( getEnv ( 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' ) )
547- const hasSocial = githubAvailable || googleAvailable
548- const hasOnlySSO = ssoEnabled && ! emailEnabled && ! hasSocial
549- const showBottomSection = hasSocial || ( ssoEnabled && ! hasOnlySSO )
550- const showDivider = ( emailEnabled || hasOnlySSO ) && showBottomSection
551- return showDivider
552- } ) ( ) && (
551+ { showDivider && (
553552 < div className = 'relative my-6 font-light' >
554553 < div className = 'absolute inset-0 flex items-center' >
555554 < div className = 'w-full border-[var(--landing-bg-elevated)] border-t' />
@@ -562,26 +561,16 @@ function SignupFormContent({ githubAvailable, googleAvailable, isProduction }: S
562561 </ div >
563562 ) }
564563
565- { ( ( ) => {
566- const ssoEnabled = isTruthy ( getEnv ( 'NEXT_PUBLIC_SSO_ENABLED' ) )
567- const emailEnabled = ! isFalsy ( getEnv ( 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' ) )
568- const hasSocial = githubAvailable || googleAvailable
569- const hasOnlySSO = ssoEnabled && ! emailEnabled && ! hasSocial
570- const showBottomSection = hasSocial || ( ssoEnabled && ! hasOnlySSO )
571- return showBottomSection
572- } ) ( ) && (
573- < div
574- className = { cn (
575- isFalsy ( getEnv ( 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' ) ) ? 'mt-8' : undefined
576- ) }
577- >
564+ { showBottomSection && (
565+ < div className = { cn ( ! emailEnabled ? 'mt-8' : undefined ) } >
578566 < SocialLoginButtons
579567 githubAvailable = { githubAvailable }
580568 googleAvailable = { googleAvailable }
569+ microsoftAvailable = { microsoftAvailable }
581570 callbackURL = { redirectUrl || '/workspace' }
582571 isProduction = { isProduction }
583572 >
584- { isTruthy ( getEnv ( 'NEXT_PUBLIC_SSO_ENABLED' ) ) && (
573+ { ssoEnabled && ! hasOnlySSO && (
585574 < SSOLoginButton callbackURL = { redirectUrl || '/workspace' } variant = 'outline' />
586575 ) }
587576 </ SocialLoginButtons >
@@ -625,14 +614,18 @@ function SignupFormContent({ githubAvailable, googleAvailable, isProduction }: S
625614export default function SignupPage ( {
626615 githubAvailable,
627616 googleAvailable,
617+ microsoftAvailable,
628618 isProduction,
619+ emailSignupEnabled,
629620} : SignupFormProps ) {
630621 return (
631622 < Suspense fallback = { < div className = 'flex h-screen items-center justify-center' > Loading…</ div > } >
632623 < SignupFormContent
633624 githubAvailable = { githubAvailable }
634625 googleAvailable = { googleAvailable }
626+ microsoftAvailable = { microsoftAvailable }
635627 isProduction = { isProduction }
628+ emailSignupEnabled = { emailSignupEnabled }
636629 />
637630 </ Suspense >
638631 )
0 commit comments