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.1.tar.gz (5.5 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.1-py2.py3-none-any.whl (7.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: django_puzzlecaptcha-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 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.1.tar.gz
Algorithm Hash digest
SHA256 47d09adb3b0197764ce36d6dc7bd443aa6698a7910b351161456e004adbacf03
MD5 73964087ddfdefa8e9643b48816c0e35
BLAKE2b-256 992fd2c1da05a1027a8db614c4e24c4f55c2cc3992d724589df9531630e183aa

See more details on using hashes here.

File details

Details for the file django_puzzlecaptcha-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_puzzlecaptcha-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 2, 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.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0296d257c85a65d17a9821b045b908dcb230d07c8c41e742fac3361240ea3f9c
MD5 539f1e44d0b5a944903007510ce79ee3
BLAKE2b-256 48e1daa9b429c3814d2b5722b689be911fe4c2de75efa5661f6c79a2a31137cb

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