New Captcha Package added
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
page CaptchaGate {
|
||||
state returnTo = ctx.url.searchParams.get("returnTo") || "/protected"
|
||||
|
||||
seo {
|
||||
title = "Complete security verification"
|
||||
robots = "noindex,nofollow"
|
||||
}
|
||||
|
||||
view {
|
||||
<main class="grid min-h-screen place-items-center bg-[var(--wire-color-bg)] px-4 py-10 text-[var(--wire-color-text)]">
|
||||
<form
|
||||
method="post"
|
||||
action="/api/page-grant"
|
||||
class="w-full max-w-xl rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 shadow-[var(--wire-shadow-1)] sm:p-7"
|
||||
>
|
||||
<input type="hidden" name="returnTo" value='{returnTo}' />
|
||||
|
||||
<p class="mb-2 text-sm font-semibold text-[var(--wire-color-primary)]">Protected page</p>
|
||||
<h1 class="m-0 text-2xl font-bold">Confirm you are human</h1>
|
||||
<p class="mb-5 mt-2 text-sm leading-6 text-[var(--wire-color-muted)]">Complete this once to access protected showcase pages for 15 minutes.</p>
|
||||
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="alphanumeric"
|
||||
action="protected-page-access"
|
||||
disturbance="50"
|
||||
required="true"
|
||||
/>
|
||||
|
||||
<button type="submit" class="mt-4 h-11 w-full rounded-[var(--wire-radius-sm)] bg-[var(--wire-color-primary)] px-5 font-semibold text-[var(--wire-color-primary-contrast)]">
|
||||
Continue to protected page
|
||||
</button>
|
||||
</form>
|
||||
</main>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
page CaptchaShowcase {
|
||||
seo {
|
||||
title = "CAPTCHA Component Showcase"
|
||||
description = "Test every WRNexus CAPTCHA mode, validation flow, page gate, and provider integration."
|
||||
}
|
||||
|
||||
view {
|
||||
<main
|
||||
class="min-h-screen bg-[var(--wire-color-bg)] px-4 py-10 text-[var(--wire-color-text)] sm:px-6 lg:px-8"
|
||||
>
|
||||
<div
|
||||
class="mx-auto flex max-w-7xl flex-col gap-10"
|
||||
>
|
||||
<header
|
||||
class="max-w-3xl"
|
||||
>
|
||||
<p
|
||||
class="mb-2 text-sm font-semibold text-[var(--wire-color-primary)]"
|
||||
>
|
||||
@wrnexus/captcha
|
||||
</p>
|
||||
<h1
|
||||
class="m-0 text-3xl font-bold tracking-tight sm:text-5xl"
|
||||
>
|
||||
CAPTCHA system showcase
|
||||
</h1>
|
||||
<p
|
||||
class="mt-4 text-base leading-7 text-[var(--wire-color-muted)]"
|
||||
>
|
||||
Self-hosted number, alphabet, alphanumeric, calculation, image, audio, not-robot, honeypot, timing, validated form-submit, and page-gate protection.
|
||||
</p>
|
||||
<a
|
||||
href="/styles"
|
||||
class="mt-4 inline-flex h-10 items-center gap-2 rounded-[var(--wire-radius-sm)] border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] px-4 text-sm font-semibold text-[var(--wire-color-text)] hover:border-[var(--wire-color-primary)]"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="icon-[lucide--images] size-4 text-[var(--wire-color-primary)]"
|
||||
>
|
||||
</span>
|
||||
Open all 18 image styles
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<section
|
||||
class="grid gap-6 lg:grid-cols-2"
|
||||
>
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Number CAPTCHA
|
||||
</h2>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="number"
|
||||
action="demo-number"
|
||||
imageStyle="random"
|
||||
disturbance="35"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Alphabet CAPTCHA
|
||||
</h2>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="alpha"
|
||||
action="demo-alpha"
|
||||
imageStyle="random"
|
||||
disturbance="40"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Alphanumeric CAPTCHA
|
||||
</h2>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="alphanumeric"
|
||||
action="demo-alphanumeric"
|
||||
imageStyle="random"
|
||||
difficulty="hard"
|
||||
disturbance="70"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Calculation CAPTCHA
|
||||
</h2>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="calculation"
|
||||
action="demo-calculation"
|
||||
imageStyle="random"
|
||||
disturbance="50"
|
||||
/>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7"
|
||||
>
|
||||
<div
|
||||
class="max-w-3xl"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-xl font-semibold"
|
||||
>
|
||||
Compact, normal, and big sizes
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm leading-6 text-[var(--wire-color-muted)]"
|
||||
>
|
||||
Use the size prop to fit dense forms, standard pages, or large security flows.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-5 grid items-start gap-5 xl:grid-cols-3"
|
||||
>
|
||||
<article
|
||||
class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4"
|
||||
>
|
||||
<h3
|
||||
class="mt-0 text-base font-semibold"
|
||||
>
|
||||
Compact
|
||||
</h3>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="number"
|
||||
action="demo-size-compact"
|
||||
size="compact"
|
||||
disturbance="30"
|
||||
showListen="false"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4"
|
||||
>
|
||||
<h3
|
||||
class="mt-0 text-base font-semibold"
|
||||
>
|
||||
Normal
|
||||
</h3>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="number"
|
||||
action="demo-size-normal"
|
||||
size="normal"
|
||||
disturbance="40"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4"
|
||||
>
|
||||
<h3
|
||||
class="mt-0 text-base font-semibold"
|
||||
>
|
||||
Big
|
||||
</h3>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="number"
|
||||
action="demo-size-big"
|
||||
size="big"
|
||||
disturbance="50"
|
||||
/>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="grid gap-6 lg:grid-cols-2"
|
||||
>
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
I'm not a robot
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm leading-6 text-[var(--wire-color-muted)]"
|
||||
>
|
||||
A low-friction, one-time checkbox challenge backed by timing, honeypot, expiry, action, session, and server-side token checks.
|
||||
</p>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="not-robot"
|
||||
action="demo-not-robot"
|
||||
size="compact"
|
||||
showAudio="false"
|
||||
showListen="false"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Listen button hidden
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm leading-6 text-[var(--wire-color-muted)]"
|
||||
>
|
||||
Set showListen to false when a separate accessible alternative is provided elsewhere.
|
||||
</p>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="alphanumeric"
|
||||
action="demo-listen-hidden"
|
||||
size="compact"
|
||||
showListen="false"
|
||||
/>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7"
|
||||
>
|
||||
<div
|
||||
class="max-w-3xl"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-xl font-semibold"
|
||||
>
|
||||
Generated image disturbance
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm leading-6 text-[var(--wire-color-muted)]"
|
||||
>
|
||||
Use the disturbance prop from 25 to 75. Lower values are easier to read; higher values add more dots and crossing lines.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-5 grid gap-5 xl:grid-cols-3"
|
||||
>
|
||||
<article
|
||||
class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4"
|
||||
>
|
||||
<div
|
||||
class="mb-3 flex items-center justify-between gap-3"
|
||||
>
|
||||
<h3
|
||||
class="m-0 text-base font-semibold"
|
||||
>
|
||||
Easy image
|
||||
</h3>
|
||||
<code
|
||||
class="rounded-md bg-[var(--wire-color-surface)] px-2 py-1 text-xs"
|
||||
>
|
||||
25%
|
||||
</code>
|
||||
</div>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="image"
|
||||
action="demo-image-easy"
|
||||
disturbance="25"
|
||||
size="big"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4"
|
||||
>
|
||||
<div
|
||||
class="mb-3 flex items-center justify-between gap-3"
|
||||
>
|
||||
<h3
|
||||
class="m-0 text-base font-semibold"
|
||||
>
|
||||
Normal image
|
||||
</h3>
|
||||
<code
|
||||
class="rounded-md bg-[var(--wire-color-surface)] px-2 py-1 text-xs"
|
||||
>
|
||||
50%
|
||||
</code>
|
||||
</div>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="image"
|
||||
action="demo-image-normal"
|
||||
disturbance="50"
|
||||
size="big"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4"
|
||||
>
|
||||
<div
|
||||
class="mb-3 flex items-center justify-between gap-3"
|
||||
>
|
||||
<h3
|
||||
class="m-0 text-base font-semibold"
|
||||
>
|
||||
Hard image
|
||||
</h3>
|
||||
<code
|
||||
class="rounded-md bg-[var(--wire-color-surface)] px-2 py-1 text-xs"
|
||||
>
|
||||
75%
|
||||
</code>
|
||||
</div>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="image"
|
||||
action="demo-image-hard"
|
||||
disturbance="75"
|
||||
difficulty="hard"
|
||||
size="big"
|
||||
/>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="grid gap-6 lg:grid-cols-2"
|
||||
>
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Audio-first challenge
|
||||
</h2>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="number"
|
||||
presentation="audio"
|
||||
action="demo-audio"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-lg font-semibold"
|
||||
>
|
||||
Invisible timing and honeypot
|
||||
</h2>
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="timing"
|
||||
presentation="invisible"
|
||||
action="demo-invisible"
|
||||
compact="true"
|
||||
/>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7"
|
||||
>
|
||||
<div
|
||||
class="max-w-3xl"
|
||||
>
|
||||
<p
|
||||
class="mb-2 text-sm font-semibold text-[var(--wire-color-primary)]"
|
||||
>
|
||||
Complete integration
|
||||
</p>
|
||||
<h2
|
||||
class="mt-0 text-xl font-semibold"
|
||||
>
|
||||
Validated contact form with CAPTCHA
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm leading-6 text-[var(--wire-color-muted)]"
|
||||
>
|
||||
The same contact schema validates in the browser and API. CAPTCHA verification remains mandatory on the server before the form is accepted.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form
|
||||
data-schema="contact"
|
||||
method="post"
|
||||
action="/api/contact"
|
||||
class="mt-6 grid max-w-3xl gap-5"
|
||||
novalidate
|
||||
>
|
||||
<div
|
||||
data-success="Validated form submitted successfully."
|
||||
hidden
|
||||
class="rounded-xl border border-[var(--wire-color-success)] bg-[color-mix(in_srgb,var(--wire-color-success)_10%,transparent)] p-4 text-sm font-medium text-[var(--wire-color-success)]"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="grid gap-5 sm:grid-cols-2"
|
||||
>
|
||||
<label
|
||||
class="grid gap-2 text-sm font-medium"
|
||||
>
|
||||
Full name
|
||||
<input
|
||||
name="name"
|
||||
type="text"
|
||||
autocomplete="name"
|
||||
placeholder="Ajay Ghanwat"
|
||||
class="h-11 rounded-[var(--wire-radius-sm)] border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] px-3 text-[var(--wire-color-text)] outline-none focus:border-[var(--wire-color-primary)] focus:ring-2 focus:ring-[var(--wire-color-primary)] aria-[invalid=true]:border-[var(--wire-color-danger)]"
|
||||
/>
|
||||
<span
|
||||
data-error="name"
|
||||
role="alert"
|
||||
class="min-h-5 text-xs text-[var(--wire-color-danger)]"
|
||||
>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label
|
||||
class="grid gap-2 text-sm font-medium"
|
||||
>
|
||||
Email address
|
||||
<input
|
||||
name="email"
|
||||
type="email"
|
||||
autocomplete="email"
|
||||
placeholder="you@example.com"
|
||||
class="h-11 rounded-[var(--wire-radius-sm)] border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] px-3 text-[var(--wire-color-text)] outline-none focus:border-[var(--wire-color-primary)] focus:ring-2 focus:ring-[var(--wire-color-primary)] aria-[invalid=true]:border-[var(--wire-color-danger)]"
|
||||
/>
|
||||
<span
|
||||
data-error="email"
|
||||
role="alert"
|
||||
class="min-h-5 text-xs text-[var(--wire-color-danger)]"
|
||||
>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label
|
||||
class="grid gap-2 text-sm font-medium"
|
||||
>
|
||||
Topic
|
||||
<select
|
||||
name="topic"
|
||||
class="h-11 rounded-[var(--wire-radius-sm)] border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] px-3 text-[var(--wire-color-text)] outline-none focus:border-[var(--wire-color-primary)] focus:ring-2 focus:ring-[var(--wire-color-primary)] aria-[invalid=true]:border-[var(--wire-color-danger)]"
|
||||
>
|
||||
<option
|
||||
value=""
|
||||
>
|
||||
Choose a topic
|
||||
</option>
|
||||
<option
|
||||
value="general"
|
||||
>
|
||||
General question
|
||||
</option>
|
||||
<option
|
||||
value="security"
|
||||
>
|
||||
Security and CAPTCHA
|
||||
</option>
|
||||
<option
|
||||
value="billing"
|
||||
>
|
||||
Billing
|
||||
</option>
|
||||
<option
|
||||
value="integration"
|
||||
>
|
||||
Integration support
|
||||
</option>
|
||||
</select>
|
||||
<span
|
||||
data-error="topic"
|
||||
role="alert"
|
||||
class="min-h-5 text-xs text-[var(--wire-color-danger)]"
|
||||
>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label
|
||||
class="grid gap-2 text-sm font-medium"
|
||||
>
|
||||
Message
|
||||
<textarea
|
||||
name="message"
|
||||
rows="5"
|
||||
placeholder="Tell us how we can help..."
|
||||
class="min-h-32 resize-y rounded-[var(--wire-radius-sm)] border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] px-3 py-3 text-[var(--wire-color-text)] outline-none focus:border-[var(--wire-color-primary)] focus:ring-2 focus:ring-[var(--wire-color-primary)] aria-[invalid=true]:border-[var(--wire-color-danger)]"
|
||||
>
|
||||
</textarea>
|
||||
<span
|
||||
data-error="message"
|
||||
role="alert"
|
||||
class="min-h-5 text-xs text-[var(--wire-color-danger)]"
|
||||
>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label
|
||||
class="flex items-start gap-3 text-sm text-[var(--wire-color-muted)]"
|
||||
>
|
||||
<input
|
||||
name="consent"
|
||||
type="checkbox"
|
||||
class="mt-0.5 size-4 rounded border-[var(--wire-color-border)] text-[var(--wire-color-primary)] focus:ring-[var(--wire-color-primary)]"
|
||||
/>
|
||||
<span
|
||||
>
|
||||
I confirm that this information may be processed for this showcase request.
|
||||
</span>
|
||||
</label>
|
||||
<span
|
||||
data-error="consent"
|
||||
role="alert"
|
||||
class="min-h-5 text-xs text-[var(--wire-color-danger)]"
|
||||
>
|
||||
</span>
|
||||
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="alphanumeric"
|
||||
action="contact-submit"
|
||||
disturbance="45"
|
||||
required="true"
|
||||
/>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="h-11 rounded-[var(--wire-radius-sm)] bg-[var(--wire-color-primary)] px-5 font-semibold text-[var(--wire-color-primary-contrast)] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
Validate and submit form
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-xl font-semibold"
|
||||
>
|
||||
Page-open protection
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm text-[var(--wire-color-muted)]"
|
||||
>
|
||||
This route uses a once-per-session page grant. After successful CAPTCHA verification, the form posts the response token and safely redirects to the requested protected route.
|
||||
</p>
|
||||
<a
|
||||
href="/protected"
|
||||
class="mt-3 inline-flex h-11 items-center rounded-[var(--wire-radius-sm)] bg-[var(--wire-color-primary)] px-5 font-semibold text-[var(--wire-color-primary-contrast)]"
|
||||
>
|
||||
Open protected page
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7"
|
||||
>
|
||||
<h2
|
||||
class="mt-0 text-xl font-semibold"
|
||||
>
|
||||
External providers
|
||||
</h2>
|
||||
<p
|
||||
class="text-sm text-[var(--wire-color-muted)]"
|
||||
>
|
||||
Add real public test keys before enabling these examples.
|
||||
</p>
|
||||
<div
|
||||
class="mt-5 grid gap-6 lg:grid-cols-3"
|
||||
>
|
||||
<Captcha
|
||||
provider="turnstile"
|
||||
siteKey=""
|
||||
action="external-turnstile"
|
||||
autoLoad="false"
|
||||
/>
|
||||
<Captcha
|
||||
provider="recaptcha"
|
||||
siteKey=""
|
||||
action="external-recaptcha"
|
||||
autoLoad="false"
|
||||
/>
|
||||
<Captcha
|
||||
provider="hcaptcha"
|
||||
siteKey=""
|
||||
action="external-hcaptcha"
|
||||
autoLoad="false"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
page ProtectedCaptchaPage {
|
||||
seo {
|
||||
title = "CAPTCHA protected page"
|
||||
robots = "noindex,nofollow"
|
||||
}
|
||||
|
||||
view {
|
||||
<main class="grid min-h-screen place-items-center bg-[var(--wire-color-bg)] px-4 py-10 text-[var(--wire-color-text)]">
|
||||
<section class="w-full max-w-2xl rounded-2xl border border-[var(--wire-color-success)] bg-[var(--wire-color-surface)] p-7 text-center shadow-[var(--wire-shadow-1)]">
|
||||
<span aria-hidden="true" class="icon-[lucide--shield-check] mx-auto block size-12 text-[var(--wire-color-success)]"></span>
|
||||
<h1 class="mt-4 text-3xl font-bold">Protected page unlocked</h1>
|
||||
<p class="text-[var(--wire-color-muted)]">The session grant is valid for 15 minutes.</p>
|
||||
<a href="/" class="mt-5 inline-flex h-11 items-center rounded-[var(--wire-radius-sm)] bg-[var(--wire-color-primary)] px-5 font-semibold text-[var(--wire-color-primary-contrast)]">Back to showcase</a>
|
||||
</section>
|
||||
</main>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
page CaptchaImageStyles {
|
||||
seo {
|
||||
title = "CAPTCHA Image Renderer Styles"
|
||||
description = "Preview every WRNexusJS CAPTCHA image renderer with easy, normal, hard, random, allowed, and excluded style controls."
|
||||
}
|
||||
|
||||
view {
|
||||
<main class="min-h-screen bg-[var(--wire-color-bg)] px-4 py-10 text-[var(--wire-color-text)] sm:px-6 lg:px-8">
|
||||
<div class="mx-auto flex max-w-7xl flex-col gap-10">
|
||||
<header class="max-w-4xl">
|
||||
<a href="/" class="mb-4 inline-flex items-center gap-2 text-sm font-semibold text-[var(--wire-color-primary)] hover:underline">
|
||||
<span aria-hidden="true" class="icon-[lucide--arrow-left] size-4"></span>
|
||||
Back to CAPTCHA showcase
|
||||
</a>
|
||||
<p class="mb-2 text-sm font-semibold text-[var(--wire-color-primary)]">Visual renderer catalog</p>
|
||||
<h1 class="m-0 text-3xl font-bold tracking-tight sm:text-5xl">18 randomized CAPTCHA image styles</h1>
|
||||
<p class="mt-4 text-base leading-7 text-[var(--wire-color-muted)]">
|
||||
Every renderer keeps the answer on the server, supports disturbance from 25 to 75, and generates a fresh cryptographically randomized image for each challenge.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<section class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7">
|
||||
<div class="max-w-3xl">
|
||||
<h2 class="mt-0 text-xl font-semibold">Random style by difficulty</h2>
|
||||
<p class="text-sm leading-6 text-[var(--wire-color-muted)]">
|
||||
Use <code>imageStyle="random"</code> for a different renderer whenever a challenge is refreshed. Difficulty controls length and default disturbance.
|
||||
</p>
|
||||
</div>
|
||||
<div class="mt-5 grid items-start gap-5 xl:grid-cols-3">
|
||||
<article class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4">
|
||||
<h3 class="mt-0 text-base font-semibold">Easy random</h3>
|
||||
<Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-random-easy" imageStyle="random" difficulty="easy" disturbance="25" size="compact" showListen="false" />
|
||||
</article>
|
||||
<article class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4">
|
||||
<h3 class="mt-0 text-base font-semibold">Normal random</h3>
|
||||
<Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-random-normal" imageStyle="random" difficulty="normal" disturbance="50" size="compact" showListen="false" />
|
||||
</article>
|
||||
<article class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4">
|
||||
<h3 class="mt-0 text-base font-semibold">Hard random</h3>
|
||||
<Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-random-hard" imageStyle="random" difficulty="hard" disturbance="75" size="compact" showListen="false" />
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-5 sm:p-7">
|
||||
<div class="max-w-3xl">
|
||||
<h2 class="mt-0 text-xl font-semibold">Controlled random pools</h2>
|
||||
<p class="text-sm leading-6 text-[var(--wire-color-muted)]">
|
||||
Limit random selection with <code>allowedStyles</code>, remove renderers with <code>excludedStyles</code>, or force random selection with <code>randomizeStyle="true"</code>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="mt-5 grid items-start gap-5 lg:grid-cols-2">
|
||||
<article class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4">
|
||||
<h3 class="mt-0 text-base font-semibold">Allowed pool</h3>
|
||||
<p class="text-xs leading-5 text-[var(--wire-color-muted)]">classic, snow, distortion, wave</p>
|
||||
<Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="number" action="style-allowed-pool" imageStyle="random" allowedStyles="classic,snow,distortion,wave" disturbance="50" size="compact" showListen="false" />
|
||||
</article>
|
||||
<article class="rounded-xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface-2)] p-4">
|
||||
<h3 class="mt-0 text-base font-semibold">Excluded styles</h3>
|
||||
<p class="text-xs leading-5 text-[var(--wire-color-muted)]">Excludes collision, split, split2, and broken-lines</p>
|
||||
<Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="number" action="style-excluded-pool" imageStyle="random" excludedStyles="collision,split,split2,broken-lines" disturbance="50" size="compact" showListen="false" />
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div class="max-w-3xl">
|
||||
<h2 class="mt-0 text-2xl font-semibold">All concrete renderers</h2>
|
||||
<p class="text-sm leading-6 text-[var(--wire-color-muted)]">Refresh any card to see a new layout, noise pattern, color treatment, and character distortion while keeping the selected renderer.</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 grid items-start gap-6 lg:grid-cols-2 xl:grid-cols-3">
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Classic</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-classic" imageStyle="classic" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Collision</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-collision" imageStyle="collision" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Snow</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-snow" imageStyle="snow" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Corrosion</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-corrosion" imageStyle="corrosion" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Spiderweb</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-spiderweb" imageStyle="spiderweb" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Cross shadow</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-cross-shadow" imageStyle="cross-shadow" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Split</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-split" imageStyle="split" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Split 2</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-split2" imageStyle="split2" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Cut</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-cut" imageStyle="cut" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Darts</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-darts" imageStyle="darts" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Distortion</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-distortion" imageStyle="distortion" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Stitch</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-stitch" imageStyle="stitch" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Striped</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-striped" imageStyle="striped" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Wave</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-wave" imageStyle="wave" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Grid noise</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-grid-noise" imageStyle="grid-noise" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Scribble</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-scribble" imageStyle="scribble" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Pixel</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-pixel" imageStyle="pixel" disturbance="50" size="compact" showListen="false" /></article>
|
||||
<article class="rounded-2xl border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-4"><h3 class="mt-0 text-base font-semibold">Broken lines</h3><Captcha endpoint="/api/captcha/challenge" verifyEndpoint="/api/captcha/verify" type="alphanumeric" action="style-broken-lines" imageStyle="broken-lines" disturbance="50" size="compact" showListen="false" /></article>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user