Skip to main content

A tool to protect formulaire from spam.

Project description

Prune's Captcha

What is it for?

Captcha helps prevent robots from spamming using your forms.

Prerequisites

  • To be installed on a Prune Django project that uses poetry or UV

UV project

Installation

Run the following command in the console:

uv add prune_captcha

Updating the captcha

Don't hesitate to regularly run uv sync --upgrade, as the captcha evolves with time and our practices!

Poetry project

Installation

Run the following command:

poetry add prune_captcha

Updating the captcha

Don't hesitate to regularly run poetry update, as the captcha evolves with time and our practices!

Captcha Integration

Configuration

In settings.py, set the path to the images used for the puzzle:

PUZZLE_IMAGE_STATIC_PATH = "website/static/website/images/puzzles/"

Important: You must import the static files (css, js) present in "prune_captcha/static/".

Utilisation

  • GET request (form display)

    • Use create_and_get_captcha to generate the captcha data:

      from prune_captcha.utils import create_and_get_captcha
      
      puzzle = create_and_get_captcha(request)
      
    • Passes the data into the context under the puzzle variable:

      return render(
          request,
          "website/pages/contact/page.html",
          {"form": form, "puzzle": puzzle},
      )
      
    • Include the component in your template:

      {% include "prune_captcha/captcha.html" %}
      
  • POST request (form submission)

    • Use verify_captcha to validate the captcha:

      from prune_captcha.utils import verify_captcha
      
      response = verify_captcha(request)
      
    • True if the captcha is correct, else False.

    • Redirects in case of incorrect captcha.

Available Versions

Version Date Notes
1.18.0 2025-05-22 create "addHiddenInputs" func
1.17.0 2025-05-21 fix pos_answer
1.16.1 2025-05-21 fix static
1.16.0 2025-05-21 fix static
1.15.2 2025-05-21 fix manifest
1.15.1 2025-05-21 fix manifest
1.15.0 2025-05-21 fix manifest
1.14.0 2025-05-21 fix static and templates dirs
1.13.0 2025-05-21 use session, add static
1.12.2 2025-05-21 doc fixed
1.12.1 2025-05-21 doc fixed
1.12.0 2025-05-21 removed views, added utils, ...
1.11.0 2025-05-21 removed utils
1.10.0 2025-05-20 fix documentation, removed ...
1.9.0 2025-05-20 puzzle images path fixed
1.8.0 2025-05-20 added migrations
1.7.0 2025-05-20 PUZZLE_IMAGE_STATIC_PATH ...
1.6.0 2025-05-20 added templates
1.5.0 2025-05-20 app config fixed, components ...
1.4.0 2025-05-20 added BaseModel in Captcha, ...
1.3.0 2025-04-30 deleted start_server, deleted ...
1.2.0 2025-04-30 fixed prune_captcha command, ...
1.1.0 2025-04-30 start_server was not a module, ...
1.0.0 2025-04-29 First version of the captcha ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prune_captcha-1.18.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prune_captcha-1.18.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file prune_captcha-1.18.0.tar.gz.

File metadata

  • Download URL: prune_captcha-1.18.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.31

File hashes

Hashes for prune_captcha-1.18.0.tar.gz
Algorithm Hash digest
SHA256 9e0e88b26fa373e7b1f0ebf02ceddee4f69266e7c852e656e532133a85d3fae6
MD5 ce413a857674c9a44d74dea588f5e123
BLAKE2b-256 14f51323502378e6631091bfc62661c8af04eb1cd03d8ea5176f6d4d23d2fe3a

See more details on using hashes here.

File details

Details for the file prune_captcha-1.18.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prune_captcha-1.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d9c11069c525036f2667eec14e30ca1b8dafa016568eeab7b63f7d71a1888b9
MD5 910439a1c99b81179d6206be1ef88cd6
BLAKE2b-256 044fb35716e1d6df93257f39f1a365fd39f04e70f3e1467e67bce76cebfcc873

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page