diff --git a/ui/app/(auth)/sign-in/page.tsx b/ui/app/(auth)/sign-in/page.tsx index b5bd978029..cb8b2df43b 100644 --- a/ui/app/(auth)/sign-in/page.tsx +++ b/ui/app/(auth)/sign-in/page.tsx @@ -1,7 +1,14 @@ import { AuthForm } from "@/components/auth/oss"; +import { isGithubOAuthEnabled, isGoogleOAuthEnabled } from "@/lib/helper"; const SignIn = () => { - return ; + return ( + + ); }; export default SignIn; diff --git a/ui/app/(auth)/sign-up/page.tsx b/ui/app/(auth)/sign-up/page.tsx index 28149bb200..37f1bc92f7 100644 --- a/ui/app/(auth)/sign-up/page.tsx +++ b/ui/app/(auth)/sign-up/page.tsx @@ -1,4 +1,6 @@ import { AuthForm } from "@/components/auth/oss"; +import { isGithubOAuthEnabled } from "@/lib/helper"; +import { isGoogleOAuthEnabled } from "@/lib/helper"; import { SearchParamsProps } from "@/types"; const SignUp = ({ searchParams }: { searchParams: SearchParamsProps }) => { @@ -7,7 +9,14 @@ const SignUp = ({ searchParams }: { searchParams: SearchParamsProps }) => { ? searchParams.invitation_token : null; - return ; + return ( + + ); }; export default SignUp; diff --git a/ui/components/auth/oss/auth-form.tsx b/ui/components/auth/oss/auth-form.tsx index 0c82cb3d13..90c86fe94a 100644 --- a/ui/components/auth/oss/auth-form.tsx +++ b/ui/components/auth/oss/auth-form.tsx @@ -25,10 +25,14 @@ export const AuthForm = ({ type, invitationToken, isCloudEnv, + isGoogleOAuthEnabled, + isGithubOAuthEnabled, }: { type: string; invitationToken?: string | null; isCloudEnv?: boolean; + isGoogleOAuthEnabled?: boolean; + isGithubOAuthEnabled?: boolean; }) => { const formSchema = authFormSchema(type); const router = useRouter(); @@ -302,9 +306,11 @@ export const AuthForm = ({ variant="bordered" as="a" href={getAuthUrl("google")} + isDisabled={!isGoogleOAuthEnabled} > Continue with Google + diff --git a/ui/lib/helper.ts b/ui/lib/helper.ts index d1dee56161..b7e67f03c9 100644 --- a/ui/lib/helper.ts +++ b/ui/lib/helper.ts @@ -34,6 +34,14 @@ export const getAuthUrl = (provider: AuthSocialProvider) => { return url.toString(); }; +export const isGoogleOAuthEnabled = + process.env.SOCIAL_GOOGLE_OAUTH_CLIENT_ID !== "" && + process.env.SOCIAL_GOOGLE_OAUTH_CLIENT_SECRET !== ""; + +export const isGithubOAuthEnabled = + process.env.SOCIAL_GITHUB_OAUTH_CLIENT_ID !== "" && + process.env.SOCIAL_GITHUB_OAUTH_CLIENT_SECRET !== ""; + export async function checkTaskStatus( taskId: string, ): Promise<{ completed: boolean; error?: string }> {