@@ -19,6 +19,7 @@ import { Suspense, useEffect, useState } from "react";
1919import { toast } from "sonner" ;
2020import { getOrganizationSSOData } from "@/actions/organization/get-organization-sso-data" ;
2121import { trackEvent } from "@/app/utils/analytics" ;
22+ import { usePublicEnv } from "@/utils/public-env" ;
2223
2324const MotionInput = motion ( Input ) ;
2425const MotionLogoBadge = motion ( LogoBadge ) ;
@@ -404,6 +405,8 @@ const NormalLogin = ({
404405 oauthError : boolean ;
405406 handleGoogleSignIn : ( ) => void ;
406407} ) => {
408+ const publicEnv = usePublicEnv ( ) ;
409+
407410 return (
408411 < motion . div >
409412 < motion . div layout className = "flex flex-col space-y-3" >
@@ -452,52 +455,59 @@ const NormalLogin = ({
452455 Sign up here
453456 </ Link >
454457 </ motion . p >
455- < div className = "flex gap-4 items-center mt-4 mb-4" >
456- < span className = "flex-1 h-px bg-gray-5" />
457- < p className = "text-sm text-center text-gray-10" > OR</ p >
458- < span className = "flex-1 h-px bg-gray-5" />
459- </ div >
460- < motion . div
461- layout
462- className = "flex flex-col gap-3 justify-center items-center"
463- >
464- { ! oauthError && (
465- < MotionButton
466- variant = "gray"
467- type = "button"
468- className = "flex gap-2 justify-center items-center w-full text-sm"
469- onClick = { handleGoogleSignIn }
470- disabled = { loading || emailSent }
471- >
472- < Image src = "/google.svg" alt = "Google" width = { 16 } height = { 16 } />
473- Login with Google
474- </ MotionButton >
475- ) }
476458
477- { oauthError && (
478- < div className = "flex gap-3 items-center p-3 bg-red-400 rounded-xl border border-red-600" >
479- < FontAwesomeIcon
480- className = "text-gray-50 size-8"
481- icon = { faExclamationCircle }
482- />
483- < p className = "text-xs leading-5 text-gray-50" >
484- It looks like you've previously used this email to sign up via
485- email login. Please enter your email.
486- </ p >
459+ { ( publicEnv . googleAuthAvailable || publicEnv . workosAuthAvailable ) && (
460+ < >
461+ < div className = "flex gap-4 items-center mt-4 mb-4" >
462+ < span className = "flex-1 h-px bg-gray-5" />
463+ < p className = "text-sm text-center text-gray-10" > OR</ p >
464+ < span className = "flex-1 h-px bg-gray-5" />
487465 </ div >
488- ) }
489- < MotionButton
490- variant = "gray"
491- type = "button"
492- className = "w-full"
493- layout
494- onClick = { ( ) => setShowOrgInput ( true ) }
495- disabled = { loading || emailSent }
496- >
497- < LucideArrowUpRight size = { 20 } />
498- Login with SAML SSO
499- </ MotionButton >
500- </ motion . div >
466+ < motion . div
467+ layout
468+ className = "flex flex-col gap-3 justify-center items-center"
469+ >
470+ { publicEnv . googleAuthAvailable && ! oauthError && (
471+ < MotionButton
472+ variant = "gray"
473+ type = "button"
474+ className = "flex gap-2 justify-center items-center w-full text-sm"
475+ onClick = { handleGoogleSignIn }
476+ disabled = { loading || emailSent }
477+ >
478+ < Image src = "/google.svg" alt = "Google" width = { 16 } height = { 16 } />
479+ Login with Google
480+ </ MotionButton >
481+ ) }
482+
483+ { oauthError && (
484+ < div className = "flex gap-3 items-center p-3 bg-red-400 rounded-xl border border-red-600" >
485+ < FontAwesomeIcon
486+ className = "text-gray-50 size-8"
487+ icon = { faExclamationCircle }
488+ />
489+ < p className = "text-xs leading-5 text-gray-50" >
490+ It looks like you've previously used this email to sign up via
491+ email login. Please enter your email.
492+ </ p >
493+ </ div >
494+ ) }
495+ { publicEnv . workosAuthAvailable && (
496+ < MotionButton
497+ variant = "gray"
498+ type = "button"
499+ className = "w-full"
500+ layout
501+ onClick = { ( ) => setShowOrgInput ( true ) }
502+ disabled = { loading || emailSent }
503+ >
504+ < LucideArrowUpRight size = { 20 } />
505+ Login with SAML SSO
506+ </ MotionButton >
507+ ) }
508+ </ motion . div >
509+ </ >
510+ ) }
501511 </ motion . div >
502512 ) ;
503513} ;
0 commit comments