Measured funnel showed home->sign_up click-through already fixed (ef2768be);
remaining friction was on the sign_up page itself: bare "Register" card with
no value prop, a visible Turnstile checkbox, and a redundant second password
field. Template-only overrides (no Go/JS-bundle fork):
- signup_inner.tmpl: one-line "free, no card" + GitHub-import promise under
the header; password mirrors into Confirm Password as typed (field stays
real/editable, backend retype-match validation untouched).
- captcha.tmpl + footer.tmpl: Gitea's bundled captcha.ts hardcodes
{sitekey,theme} and ignores any data-appearance attribute, so renamed the
cfturnstile div so Gitea's own initCaptcha() no-ops, and render the real
Turnstile widget ourselves via the custom/footer.tmpl script hook with
appearance:'interaction-only' — same challenge, no visible checkbox for
well-behaved visitors, Siteverify still runs server-side on submit.
Verified live: form renders clean (no checkbox) at 1440px and 390px, invalid
captcha correctly still errors ("The CAPTCHA code is incorrect"), password
mirror works, post-login landing reaches the GitHub importer in one click.
56 lines
3.0 KiB
Cheetah
56 lines
3.0 KiB
Cheetah
<!--
|
|
Override of upstream templates/user/auth/captcha.tmpl (go-gitea/gitea
|
|
v1.23.8). Byte-identical for every captcha type except cfturnstile.
|
|
|
|
2026-11-18 (rithub-signup-page-friction fix): per task brief, make
|
|
Turnstile "invisible/managed" without removing captcha protection.
|
|
Cloudflare Turnstile's real render parameter for this is
|
|
`appearance: 'interaction-only'` -- the widget still runs its real
|
|
challenge, but only becomes visible if Cloudflare decides an
|
|
interactive step is actually needed; well-behaved real visitors see
|
|
no checkbox/box at all. Gitea's own bundled web_src/js/features/
|
|
captcha.ts hardcodes `{sitekey, theme}` only and does NOT read any
|
|
`data-*` attribute for appearance (checked the real v1.23.8 source --
|
|
a `data-appearance` attribute on #captcha would be silently ignored),
|
|
and that JS ships compiled into index.js, not patchable from custom/
|
|
(no Go/JS-bundle fork, per task brief). Real fix: rename this div's id
|
|
so Gitea's generic `initCaptcha()` (`document.querySelector('#captcha')`)
|
|
finds nothing here and no-ops (confirmed safe: it already returns
|
|
early on a null element), then render the real Turnstile widget
|
|
ourselves with the extra param, via the documented custom/footer.tmpl
|
|
script hook (see that file) -- same "can't touch the bundle, so hook
|
|
around it" pattern already used there for the repo_name focus fix.
|
|
Does not disable or bypass the captcha -- Siteverify is still called
|
|
server-side on submit exactly as before, same hidden
|
|
`cf-turnstile-response` field name Turnstile always injects.
|
|
-->
|
|
{{if .EnableCaptcha}}{{if eq .CaptchaType "image"}}
|
|
<div class="inline field tw-text-center">
|
|
{{.Captcha.CreateHTML}}
|
|
</div>
|
|
<div class="required field {{if .Err_Captcha}}error{{end}}">
|
|
<label for="captcha">{{ctx.Locale.Tr "captcha"}}</label>
|
|
<input id="captcha" name="captcha" value="{{.captcha}}" autocomplete="off">
|
|
</div>
|
|
{{else if eq .CaptchaType "recaptcha"}}
|
|
<div class="inline field tw-text-center required">
|
|
<div id="captcha" data-captcha-type="g-recaptcha" class="g-recaptcha-style" data-sitekey="{{.RecaptchaSitekey}}"></div>
|
|
</div>
|
|
<script src='{{URLJoin .RecaptchaURL "api.js"}}'></script>
|
|
{{else if eq .CaptchaType "hcaptcha"}}
|
|
<div class="inline field tw-text-center required">
|
|
<div id="captcha" data-captcha-type="h-captcha" class="h-captcha-style" data-sitekey="{{.HcaptchaSitekey}}"></div>
|
|
</div>
|
|
<script src='https://hcaptcha.com/1/api.js'></script>
|
|
{{else if eq .CaptchaType "mcaptcha"}}
|
|
<div class="inline field tw-text-center">
|
|
<div class="m-captcha-style" id="mcaptcha__widget-container"></div>
|
|
<div id="captcha" data-captcha-type="m-captcha" data-sitekey="{{.McaptchaSitekey}}" data-instance-url="{{.McaptchaURL}}"></div>
|
|
</div>
|
|
{{else if eq .CaptchaType "cfturnstile"}}
|
|
<div class="inline field tw-text-center">
|
|
<div id="rithub-captcha" data-captcha-type="cf-turnstile" data-sitekey="{{.CfTurnstileSitekey}}"></div>
|
|
</div>
|
|
<script src='https://challenges.cloudflare.com/turnstile/v0/api.js'></script>
|
|
{{end}}{{end}}
|