feat(auth) : protect admin login with turnstile
This commit is contained in:
+10
-2
@@ -3,7 +3,7 @@ import "server-only";
|
||||
import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import { nextCookies } from "better-auth/next-js";
|
||||
import { admin } from "better-auth/plugins";
|
||||
import { admin, captcha } from "better-auth/plugins";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
import { getDb } from "@/db";
|
||||
@@ -60,7 +60,15 @@ function createAuth() {
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [admin({ defaultRole: "admin" }), nextCookies()],
|
||||
plugins: [
|
||||
captcha({
|
||||
provider: "cloudflare-turnstile",
|
||||
secretKey: required("TURNSTILE_SECRET_KEY"),
|
||||
endpoints: ["/sign-in/email"],
|
||||
}),
|
||||
admin({ defaultRole: "admin" }),
|
||||
nextCookies(),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user