Polish onboarding, invoices, and time clock while promoting the first registrant to admin.
Refresh onboarding wizard and shell, tighten invoice edit/detail flows, align timer widgets with the redesigned clock panel, and assign admin role on first signup. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import { nextCookies } from "better-auth/next-js";
|
||||
import { genericOAuth } from "better-auth/plugins";
|
||||
import { envBoolean } from "~/lib/env-boolean";
|
||||
import { isDemoUser, promoteFirstRealUserIfNeeded } from "~/lib/first-admin";
|
||||
import { db } from "~/server/db";
|
||||
import * as schema from "~/server/db/schema";
|
||||
|
||||
@@ -48,6 +49,18 @@ export const auth = betterAuth({
|
||||
verification: schema.verificationTokens,
|
||||
},
|
||||
}),
|
||||
databaseHooks: {
|
||||
user: {
|
||||
create: {
|
||||
after: async (user) => {
|
||||
if (isDemoUser(user)) {
|
||||
return;
|
||||
}
|
||||
await promoteFirstRealUserIfNeeded(user.id);
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
trustedOrigins: async (request) => {
|
||||
const origins = [...staticTrustedOrigins];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user