feat: add Cloudflare Turnstile captcha to auth flow

- Add captcha plugin to Better Auth config (cloudflare-turnstile provider)
- Create reusable TurnstileWidget component with script injection
- Integrate Turnstile into login, signup, and forgot-password forms
- Pass x-captcha-response header on protected endpoints
- Add TURNSTILE_SECRET_KEY and NEXT_PUBLIC_TURNSTILE_SITE_KEY to env
This commit is contained in:
2026-06-26 21:50:45 +08:00
parent 7d78f1834d
commit ec5ee7fb18
6 changed files with 199 additions and 6 deletions
+9
View File
@@ -58,6 +58,15 @@ R2_SECRET_ACCESS_KEY=
R2_BUCKET_NAME=deckyvault
R2_PUBLIC_URL=
# -----------------------------------------------------------------------------
# CAPTCHA (CLOUDFLARE TURNSTILE)
# -----------------------------------------------------------------------------
# Cloudflare Turnstile site key (public, used in client-side widget)
NEXT_PUBLIC_TURNSTILE_SITE_KEY="0x4AAAAAADrebUvw0DbPkPSc"
# Cloudflare Turnstile secret key (server-side verification)
TURNSTILE_SECRET_KEY="0x4AAAAAADrebeHpOUElKVG4bxd3EBbdBrk"
# -----------------------------------------------------------------------------
# CRON
# -----------------------------------------------------------------------------