From 6aed075c56ee9ef77fa4613d8d395bd23bd7b0de Mon Sep 17 00:00:00 2001
From: Anurag Sharma
Date: Tue, 23 Jan 2024 11:38:48 +0530
Subject: [PATCH] fix: add conditional rendering of OAuth providers (#736)
Now google OAuth provider is not rendered if client id is not provided
---
.../src/app/(unauthenticated)/signin/page.tsx | 4 +-
apps/web/src/components/forms/signin.tsx | 40 +++++++++++--------
packages/lib/constants/auth.ts | 4 ++
3 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/apps/web/src/app/(unauthenticated)/signin/page.tsx b/apps/web/src/app/(unauthenticated)/signin/page.tsx
index 0b0333b65..5fda07e70 100644
--- a/apps/web/src/app/(unauthenticated)/signin/page.tsx
+++ b/apps/web/src/app/(unauthenticated)/signin/page.tsx
@@ -1,5 +1,7 @@
import Link from 'next/link';
+import { IS_GOOGLE_SSO_ENABLED } from '@documenso/lib/constants/auth';
+
import { SignInForm } from '~/components/forms/signin';
export default function SignInPage() {
@@ -11,7 +13,7 @@ export default function SignInPage() {
Welcome back, we are lucky to have you.
-
+
{process.env.NEXT_PUBLIC_DISABLE_SIGNUP !== 'true' && (
diff --git a/apps/web/src/components/forms/signin.tsx b/apps/web/src/components/forms/signin.tsx
index 4e671a569..038f9fe68 100644
--- a/apps/web/src/components/forms/signin.tsx
+++ b/apps/web/src/components/forms/signin.tsx
@@ -48,9 +48,10 @@ export type TSignInFormSchema = z.infer;
export type SignInFormProps = {
className?: string;
+ isGoogleSSOEnabled?: boolean;
};
-export const SignInForm = ({ className }: SignInFormProps) => {
+export const SignInForm = ({ className, isGoogleSSOEnabled }: SignInFormProps) => {
const { toast } = useToast();
const [isTwoFactorAuthenticationDialogOpen, setIsTwoFactorAuthenticationDialogOpen] =
useState(false);
@@ -203,24 +204,29 @@ export const SignInForm = ({ className }: SignInFormProps) => {
{isSubmitting ? 'Signing in...' : 'Sign In'}
-
+ {isGoogleSSOEnabled && (
+ <>
+
-
+
+ >
+ )}
+