feat : big update
This commit is contained in:
+9
-2
@@ -52,7 +52,7 @@ function createAuth() {
|
||||
secret: required("BETTER_AUTH_SECRET"),
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
disableSignUp: true,
|
||||
disableSignUp: false,
|
||||
minPasswordLength: 12,
|
||||
maxPasswordLength: 128,
|
||||
},
|
||||
@@ -72,7 +72,7 @@ function createAuth() {
|
||||
captcha({
|
||||
provider: "cloudflare-turnstile",
|
||||
secretKey: required("TURNSTILE_SECRET_KEY"),
|
||||
endpoints: ["/sign-in/email"],
|
||||
endpoints: ["/sign-in/email", "/sign-up/email"],
|
||||
}),
|
||||
]),
|
||||
admin({ defaultRole: "user" }),
|
||||
@@ -125,3 +125,10 @@ export async function requireAdmin(): Promise<AdminSession> {
|
||||
if (!session) throw new AdminAuthorizationError();
|
||||
return session;
|
||||
}
|
||||
|
||||
export const getCustomerSession = cache(async () => {
|
||||
if (!hasAuthConfiguration()) return null;
|
||||
const session = await getAuth().api.getSession({ headers: await headers() });
|
||||
if (!session?.session) return null;
|
||||
return { user: session.user, session: { id: session.session.id } };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user