File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11import { drizzleAdapter } from "better-auth/adapters/drizzle" ;
22import { betterAuth } from "better-auth" ;
3- import { db } from "@devlogs_hosting/db" ;
3+ import { db , dorm , main_schema } from "@devlogs_hosting/db" ;
44import * as schema from "@devlogs_hosting/db/schema/auth" ;
55import { 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 ( )
You can’t perform that action at this time.
0 commit comments