diff --git a/docs/.env.local.example b/docs/.env.local.example index cb90db5a97..a2dba36b4b 100644 --- a/docs/.env.local.example +++ b/docs/.env.local.example @@ -30,4 +30,6 @@ BETTER_AUTH_URL=http://localhost:3000 # SENTRY_AUTH_TOKEN= NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_API_KEY= -NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL= \ No newline at end of file +NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL= + +TURNSTILE_SECRET_KEY= \ No newline at end of file diff --git a/docs/app/demo/page.tsx b/docs/app/demo/page.tsx index 6e7a5833f2..56a9ed937e 100644 --- a/docs/app/demo/page.tsx +++ b/docs/app/demo/page.tsx @@ -9,6 +9,10 @@ export default function DemoPage() { + ); } diff --git a/docs/app/pricing/page.tsx b/docs/app/pricing/page.tsx index 4664aa6d81..e7c1368186 100644 --- a/docs/app/pricing/page.tsx +++ b/docs/app/pricing/page.tsx @@ -207,6 +207,10 @@ export default function Pricing() { {/* FAQ */} + ); } diff --git a/docs/components/AuthenticationPage.tsx b/docs/components/AuthenticationPage.tsx index ebe79ff888..d68c0cf50e 100644 --- a/docs/components/AuthenticationPage.tsx +++ b/docs/components/AuthenticationPage.tsx @@ -1,6 +1,7 @@ "use client"; import { authClient, signIn, signUp } from "@/lib/auth-client"; +import { Turnstile } from "@marsidev/react-turnstile"; import * as Sentry from "@sentry/nextjs"; import { track } from "@vercel/analytics"; import { useRouter, useSearchParams } from "next/navigation"; @@ -53,6 +54,7 @@ function AuthenticationBox(props: { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); + const [turnstileToken, setTurnstileToken] = useState(""); const [signingInState, setSigningInState] = useState< | { state: "init" } @@ -130,7 +132,7 @@ function AuthenticationBox(props: { }, }, ); - } else { + } else if (props.variant === "register") { track("click-sign-up", { type: "email" }); Sentry.captureEvent({ message: "click-sign-up", @@ -147,6 +149,9 @@ function AuthenticationBox(props: { callbackURL: "/pricing", }, { + headers: { + "x-captcha-response": turnstileToken, + }, onSuccess() { setSigningInState({ state: "done", @@ -172,6 +177,9 @@ function AuthenticationBox(props: { }, }, ); + } else { + const variant = props.variant satisfies never; + throw new Error("Invalid authentication variant " + variant); } }; @@ -213,6 +221,13 @@ function AuthenticationBox(props: { onChange={(e) => setPassword(e.target.value)} /> )} + {props.variant === "register" && ( + + )}