FCaptcha icon indicating copy to clipboard operation
FCaptcha copied to clipboard

Example: Django form with server-side verification

Open cport1 opened this issue 1 month ago • 2 comments

examples/ has runnable integrations for Hono, Supabase, FastAPI and a plain Node contact form. A Django example would cover a lot of Python users.

What to do

Add examples/django/ with:

  • a form view whose template renders the checkbox widget
  • server-side verification of the posted fcaptcha_token against /turnstile/v0/siteverify or /api/token/verify (a small form field or a validator is fine)
  • tests for a valid, a replayed and a missing token, in the style of examples/fastapi/test_main.py
  • a README with how to run it against a local FCaptcha server

Bonus: a note on using django-recaptcha unchanged by setting RECAPTCHA_DOMAIN to your FCaptcha server, which v1.45.0 makes possible.

Done when

The example runs from its README, and a link is added under "Runnable examples" in the main README.

cport1 avatar Oct 13 '26 14:10 cport1

Thanks, @Vedant-200. Please go ahead with the runnable example. There is now a Django integration guide in INSTALLATION.md, so please reuse that contract rather than duplicating the guide: https://github.com/WebDecoy/FCaptcha/blob/main/INSTALLATION.md

The missing piece here is still a runnable examples/django app with tests. Keep the verification secret server-side, verify before the protected action, and cover missing, rejected/replayed, and unavailable verification as well as success. Please use the current documented site-key/hostname/action checks. A focused PR with its run/test commands would be helpful.

cport1 avatar Nov 17 '26 18:11 cport1