Skip to content

The Open Source DocuSign Alternative.

feat: make oidc sign in button text configurable (#1209)

Rene Steen5582f29bda3b
diff --git a/.env.example b/.env.example
index 19f056cd8..bba951b86 100644
--- a/.env.example
+++ b/.env.example
@@ -16,6 +16,7 @@ NEXT_PRIVATE_GOOGLE_CLIENT_SECRET=""
NEXT_PRIVATE_OIDC_WELL_KNOWN=""
NEXT_PRIVATE_OIDC_CLIENT_ID=""
NEXT_PRIVATE_OIDC_CLIENT_SECRET=""
+NEXT_PRIVATE_OIDC_PROVIDER_LABEL="OIDC"
# This can be used to still allow signups for OIDC connections
# when signup is disabled via `NEXT_PUBLIC_DISABLE_SIGNUP`
NEXT_PRIVATE_OIDC_ALLOW_SIGNUP=""
diff --git a/apps/web/src/app/(unauthenticated)/signin/page.tsx b/apps/web/src/app/(unauthenticated)/signin/page.tsx
index a0599ac1a..8efa19abc 100644
--- a/apps/web/src/app/(unauthenticated)/signin/page.tsx
+++ b/apps/web/src/app/(unauthenticated)/signin/page.tsx
@@ -4,7 +4,11 @@ import { redirect } from 'next/navigation';
import { env } from 'next-runtime-env';
-import { IS_GOOGLE_SSO_ENABLED, IS_OIDC_SSO_ENABLED } from '@documenso/lib/constants/auth';
+import {
+ IS_GOOGLE_SSO_ENABLED,
+ IS_OIDC_SSO_ENABLED,
+ OIDC_PROVIDER_LABEL,
+} from '@documenso/lib/constants/auth';
import { decryptSecondaryData } from '@documenso/lib/server-only/crypto/decrypt';
import { SignInForm } from '~/components/forms/signin';
@@ -43,6 +47,7 @@ export default function SignInPage({ searchParams }: SignInPageProps) {
initialEmail={email || undefined}
isGoogleSSOEnabled={IS_GOOGLE_SSO_ENABLED}
isOIDCSSOEnabled={IS_OIDC_SSO_ENABLED}
+ oidcProviderLabel={OIDC_PROVIDER_LABEL}
/>
{NEXT_PUBLIC_DISABLE_SIGNUP !== 'true' && (
diff --git a/apps/web/src/components/forms/signin.tsx b/apps/web/src/components/forms/signin.tsx
index e86ad492f..8edccfc45 100644
--- a/apps/web/src/components/forms/signin.tsx
+++ b/apps/web/src/components/forms/signin.tsx
@@ -71,6 +71,7 @@ export type SignInFormProps = {
initialEmail?: string;
isGoogleSSOEnabled?: boolean;
isOIDCSSOEnabled?: boolean;
+ oidcProviderLabel?: string;
};
export const SignInForm = ({
@@ -78,6 +79,7 @@ export const SignInForm = ({
initialEmail,
isGoogleSSOEnabled,
isOIDCSSOEnabled,
+ oidcProviderLabel,
}: SignInFormProps) => {
const { toast } = useToast();
const { getFlag } = useFeatureFlags();
@@ -369,7 +371,7 @@ export const SignInForm = ({
onClick={onSignInWithOIDCClick}
>
<FaIdCardClip className="mr-2 h-5 w-5" />
- OIDC
+ {oidcProviderLabel || 'OIDC'}
</Button>
)}
diff --git a/packages/lib/constants/auth.ts b/packages/lib/constants/auth.ts
index 4df19b407..a8b5f31a2 100644
--- a/packages/lib/constants/auth.ts
+++ b/packages/lib/constants/auth.ts
@@ -18,6 +18,8 @@ export const IS_OIDC_SSO_ENABLED = Boolean(
process.env.NEXT_PRIVATE_OIDC_CLIENT_SECRET,
);
+export const OIDC_PROVIDER_LABEL = process.env.NEXT_PRIVATE_OIDC_PROVIDER_LABEL;
+
export const USER_SECURITY_AUDIT_LOG_MAP: { [key in UserSecurityAuditLogType]: string } = {
[UserSecurityAuditLogType.ACCOUNT_SSO_LINK]: 'Linked account to SSO',
[UserSecurityAuditLogType.ACCOUNT_PROFILE_UPDATE]: 'Profile updated',
diff --git a/packages/tsconfig/process-env.d.ts b/packages/tsconfig/process-env.d.ts
index 5ef087199..5eac76101 100644
--- a/packages/tsconfig/process-env.d.ts
+++ b/packages/tsconfig/process-env.d.ts
@@ -9,6 +9,7 @@ declare namespace NodeJS {
NEXT_PRIVATE_OIDC_WELL_KNOWN?: string;
NEXT_PRIVATE_OIDC_CLIENT_ID?: string;
NEXT_PRIVATE_OIDC_CLIENT_SECRET?: string;
+ NEXT_PRIVATE_OIDC_PROVIDER_LABEL?: string;
NEXT_PRIVATE_OIDC_ALLOW_SIGNUP?: string;
NEXT_PRIVATE_OIDC_SKIP_VERIFY?: string;
diff --git a/turbo.json b/turbo.json
index a28e2e3a5..95acc04cf 100644
--- a/turbo.json
+++ b/turbo.json
@@ -69,6 +69,7 @@
"NEXT_PRIVATE_OIDC_WELL_KNOWN",
"NEXT_PRIVATE_OIDC_CLIENT_ID",
"NEXT_PRIVATE_OIDC_CLIENT_SECRET",
+ "NEXT_PRIVATE_OIDC_PROVIDER_LABEL",
"NEXT_PRIVATE_OIDC_ALLOW_SIGNUP",
"NEXT_PRIVATE_OIDC_SKIP_VERIFY",
"NEXT_PUBLIC_UPLOAD_TRANSPORT",