Skip to content

Commit dbd95d7

Browse files
authored
Register Auth Patch, this allows anyone to register with a POST request on a third-party API client (v0.1.11) (#15)
* Update navbar * yeee * ok * update (thx coderabiit) * ok * Important Patch
1 parent 1424dcc commit dbd95d7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

AGENT.md

Whitespace-only changes.

packages/auth/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { drizzleAdapter } from "better-auth/adapters/drizzle";
22
import { betterAuth } from "better-auth";
3-
import { db } from "@devlogs_hosting/db";
3+
import { db, dorm, main_schema } from "@devlogs_hosting/db";
44
import * as schema from "@devlogs_hosting/db/schema/auth";
55
import { admin } from "better-auth/plugins";
66

@@ -29,6 +29,14 @@ export const auth = betterAuth({
2929
create: {
3030
before: async (user, ctx) => {
3131
try {
32+
const checkIfSystemDisabledRegister = await db
33+
.select()
34+
.from(main_schema.kvData)
35+
.where(dorm.eq(main_schema.kvData.key, "registrationStatus"))
36+
.limit(1);
37+
if (checkIfSystemDisabledRegister[0]?.value === false) {
38+
throw new Error("Registration is disabled");
39+
}
3240
// Query database directly using your existing Drizzle connection
3341
const existingUsers = await db
3442
.select()

0 commit comments

Comments
 (0)