Skip to main content

PuzzleCaptcha: Simplified Math CAPTCHA Using Pillow Image Library

Project description

django-puzzlecaptcha

PuzzleCaptcha: Simplified Math CAPTCHA Using Pillow Image Library

Preview

Features

  • Easy integration with Django projects
  • Use pillow & numpy to generate image
  • Customizable configuration

Installation

1. Install the Package

pip install django-puzzlecaptcha

2. Configure Django Settings

Add puzzlecaptcha to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'puzzlecaptcha',
    ...
]

3. Configuration

In your settings.py, you can customize the puzzlecaptcha behavior:

PUZZLECAPTCHA = {
    "CAPTCHA_FONT_SIZE": 35,
    "CAPTCHA_IMAGE_SIZE": (150, 50),
    "CAPTCHA_NOISE_LINES": 20,
    "CAPTCHA_NOISE_LINES_WIDTH": 2,
    "CAPTCHA_NOISE_COLOR": "black",
    "CAPTCHA_FOREGROUND_COLOR": "black",
    "CAPTCHA_BACKGROUND_COLOR": "white",
    "CAPTCHA_CACHE_PREFIX": "puzzlecaptcha",
    "CAPTCHA_CACHE_BACKEND": "default",
    "CAPTCHA_TIMEOUT": 300,
}

4. To Enable on Admin Login Form (Optional)

In your project's urls.py:

from puzzlecaptcha.forms import AdminAuthenticationForm

admin.site.login_form = AdminAuthenticationForm
admin.site.login_template = 'puzzlecaptcha/admin_login.html'

urlpatterns = [
    path("admin/", admin.site.urls),
    ....
]

Usage Example

from puzzlecaptcha.field import MathCaptchaField

class AuthenticationForm(form.Form):
    captcha = MathCaptchaField()

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Support

If you encounter any issues or have questions, please open an issue on GitHub.

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

django_puzzlecaptcha-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

django_puzzlecaptcha-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file django_puzzlecaptcha-0.1.0.tar.gz.

File metadata

  • Download URL: django_puzzlecaptcha-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.0 Linux/6.11.10-300.fc41.x86_64

File hashes

Hashes for django_puzzlecaptcha-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4064cba1efaf6c0545a69239f7932e95289d0bd518580114ed48a6710aea3398
MD5 3e816fd850024b3cf84e6f647b2d17b3
BLAKE2b-256 6b63bf0c6b2cafa50d7f996232b53a6aeb78f0847cb92c619a56b882812aab86

See more details on using hashes here.

File details

Details for the file django_puzzlecaptcha-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_puzzlecaptcha-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.0 Linux/6.11.10-300.fc41.x86_64

File hashes

Hashes for django_puzzlecaptcha-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0e9ddadd2869d446205dfbd6a48512d219b7c1532582ae8a6df2250556cffbd
MD5 b8f8a62492e261dd0bcc00d5e6a51585
BLAKE2b-256 f5ed74b092da66541c0e907249d0841f42dc3e51564878f44d3033ac4557e985

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