From 19bf0802ba23b76a424bb8a5955b2ece69a932ad Mon Sep 17 00:00:00 2001 From: Nevo David Date: Sun, 8 Jun 2025 22:26:02 +0700 Subject: [PATCH] feat: dont disable oidc when DISABLE_REGISTRATION is on --- apps/frontend/src/app/(app)/auth/page.tsx | 18 +++++++---- .../src/components/auth/login.with.oidc.tsx | 32 +++++++++++++++++++ .../auth/providers/oauth.provider.tsx | 2 ++ 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 apps/frontend/src/components/auth/login.with.oidc.tsx diff --git a/apps/frontend/src/app/(app)/auth/page.tsx b/apps/frontend/src/app/(app)/auth/page.tsx index 04bbd735..d722e640 100644 --- a/apps/frontend/src/app/(app)/auth/page.tsx +++ b/apps/frontend/src/app/(app)/auth/page.tsx @@ -5,6 +5,7 @@ import { Metadata } from 'next'; import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side'; import Link from 'next/link'; import { getT } from '@gitroom/react/translation/get.translation.service.backend'; +import { LoginWithOidc } from '@gitroom/frontend/components/auth/login.with.oidc'; export const metadata: Metadata = { title: `${isGeneralServerSide() ? 'Postiz' : 'Gitroom'} Register`, description: '', @@ -18,13 +19,16 @@ export default async function Auth() { ).register; if (!canRegister) { return ( -
- {t('registration_is_disabled', 'Registration is disabled')} -
- - {t('login_instead', 'Login instead')} - -
+ <> + +
+ {t('registration_is_disabled', 'Registration is disabled')} +
+ + {t('login_instead', 'Login instead')} + +
+ ); } } diff --git a/apps/frontend/src/components/auth/login.with.oidc.tsx b/apps/frontend/src/components/auth/login.with.oidc.tsx new file mode 100644 index 00000000..ee9e5e7a --- /dev/null +++ b/apps/frontend/src/components/auth/login.with.oidc.tsx @@ -0,0 +1,32 @@ +'use client'; + +import { OauthProvider } from '@gitroom/frontend/components/auth/providers/oauth.provider'; +import interClass from '@gitroom/react/helpers/inter.font'; +import { useT } from '@gitroom/react/translation/get.transation.service.client'; +import { useVariables } from '@gitroom/react/helpers/variable.context'; + +export const LoginWithOidc = () => { + const { isGeneral, genericOauth } = useVariables(); + const t = useT(); + + if (!(isGeneral && genericOauth)) { + return null; + } + + return ( + <> +
+

+ {t('sign_up', 'Sign Up')} +

+
+ +
+
+
+
+ + ); +}; diff --git a/apps/frontend/src/components/auth/providers/oauth.provider.tsx b/apps/frontend/src/components/auth/providers/oauth.provider.tsx index 5e51eb8d..18ce942f 100644 --- a/apps/frontend/src/components/auth/providers/oauth.provider.tsx +++ b/apps/frontend/src/components/auth/providers/oauth.provider.tsx @@ -1,3 +1,5 @@ +'use client'; + import { useCallback } from 'react'; import Image from 'next/image'; import { useFetch } from '@gitroom/helpers/utils/custom.fetch';