diff options
| author | kamtschatka <simon.schatka@gmx.at> | 2024-10-06 10:06:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-06 09:06:19 +0100 |
| commit | 4a3775a9ac4242318dd7b91f0012cd756edcad7b (patch) | |
| tree | 21811c995067527fa5ca0aeab22f7a28da8f1e45 /packages/trpc | |
| parent | 8a1309536b76ba86872ca2e78aa695d9fd80c8cc (diff) | |
| download | karakeep-4a3775a9ac4242318dd7b91f0012cd756edcad7b.tar.zst | |
feature: Allow disabling password signups (#413)
* [Feature Request] Allow to disable default password log in after SSO is configured #406
Added the DISABLE_LOCAL_SIGNUPS that can be used to force OAuth signups only
* rename local signups to password signups
---------
Co-authored-by: MohamedBassem <me@mbassem.com>
Diffstat (limited to 'packages/trpc')
| -rw-r--r-- | packages/trpc/routers/users.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/trpc/routers/users.ts b/packages/trpc/routers/users.ts index ba1aee24..736e7e2f 100644 --- a/packages/trpc/routers/users.ts +++ b/packages/trpc/routers/users.ts @@ -29,10 +29,16 @@ export const usersAppRouter = router({ }), ) .mutation(async ({ input, ctx }) => { - if (serverConfig.auth.disableSignups) { + if ( + serverConfig.auth.disableSignups || + serverConfig.auth.disablePasswordSignups + ) { + const errorMessage = serverConfig.auth.disablePasswordSignups + ? "Local Signups are disabled in the server config. Use OAuth instead!" + : "Signups are disabled in server config"; throw new TRPCError({ code: "FORBIDDEN", - message: "Signups are disabled in server config", + message: errorMessage, }); } // TODO: This is racy, but that's probably fine. |
