diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/web/components/signin/CredentialsForm.tsx | 8 | ||||
| -rw-r--r-- | apps/web/lib/clientConfig.tsx | 3 | ||||
| -rw-r--r-- | apps/web/server/auth.ts | 6 |
3 files changed, 10 insertions, 7 deletions
diff --git a/apps/web/components/signin/CredentialsForm.tsx b/apps/web/components/signin/CredentialsForm.tsx index 8e1423eb..5e3b4de9 100644 --- a/apps/web/components/signin/CredentialsForm.tsx +++ b/apps/web/components/signin/CredentialsForm.tsx @@ -13,6 +13,7 @@ import { } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { useClientConfig } from "@/lib/clientConfig"; import { api } from "@/lib/trpc"; import { zodResolver } from "@hookform/resolvers/zod"; import { TRPCClientError } from "@trpc/client"; @@ -100,6 +101,7 @@ function SignIn() { } function SignUp() { + const clientConfig = useClientConfig(); const form = useForm<z.infer<typeof zSignUpSchema>>({ resolver: zodResolver(zSignUpSchema), }); @@ -201,7 +203,11 @@ function SignUp() { ); }} /> - <ActionButton type="submit" loading={form.formState.isSubmitting}> + <ActionButton + type="submit" + loading={form.formState.isSubmitting} + disabled={clientConfig.auth.disableSignups} + > Sign Up </ActionButton> </div> diff --git a/apps/web/lib/clientConfig.tsx b/apps/web/lib/clientConfig.tsx index fac76d3b..10ca1010 100644 --- a/apps/web/lib/clientConfig.tsx +++ b/apps/web/lib/clientConfig.tsx @@ -4,6 +4,9 @@ import type { ClientConfig } from "@hoarder/shared/config"; export const ClientConfigCtx = createContext<ClientConfig>({ demoMode: false, + auth: { + disableSignups: false, + }, }); export function useClientConfig() { diff --git a/apps/web/server/auth.ts b/apps/web/server/auth.ts index 767bc7e8..acc3745c 100644 --- a/apps/web/server/auth.ts +++ b/apps/web/server/auth.ts @@ -5,12 +5,10 @@ import NextAuth, { getServerSession, NextAuthOptions, } from "next-auth"; -import AuthentikProvider from "next-auth/providers/authentik"; import CredentialsProvider from "next-auth/providers/credentials"; import { Provider } from "next-auth/providers/index"; import { db } from "@hoarder/db"; -import serverConfig from "@hoarder/shared/config"; import { validatePassword } from "@hoarder/trpc/auth"; declare module "next-auth/jwt" { @@ -63,10 +61,6 @@ const providers: Provider[] = [ }), ]; -if (serverConfig.auth.authentik) { - providers.push(AuthentikProvider(serverConfig.auth.authentik)); -} - export const authOptions: NextAuthOptions = { // https://github.com/nextauthjs/next-auth/issues/9493 adapter: DrizzleAdapter(db) as Adapter, |
