Giter Site home page Giter Site logo

jraylan / django-hcaptcha-field Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tiesjan/django-hcaptcha-field

0.0 0.0 0.0 51 KB

Django hCaptcha Field provides a simple way to protect your Django forms using hCaptcha.

Home Page: https://pypi.org/project/django-hcaptcha-field/

License: BSD 3-Clause "New" or "Revised" License

Python 99.31% HTML 0.69%

django-hcaptcha-field's Introduction

Django hCaptcha Field

Python unit tests Linters

Django hCaptcha Field provides a simple way to protect your Django forms using hCaptcha.

This is a fork of django-hcaptcha.

Installation

  1. Install using pip:

    $ pip install django-hcaptcha-field
  2. Add to INSTALLED_APPS:

    INSTALLED_APPS = [
        # ...
        'hcaptcha_field'
    ]

Configuration

For development purposes no further configuration is required. By default, Django hCaptcha Field will use test keys.

For production, you'll need to obtain your hCaptcha site key and secret key and add them to you settings:

HCAPTCHA_SITEKEY = '<your sitekey>'
HCAPTCHA_SECRET = '<your secret key>'

You can also configure your hCaptcha widget globally (see all options):

HCAPTCHA_DEFAULT_CONFIG = {
    'onload': 'name_of_js_function',
    'render': 'explicit',
    'theme': 'dark',  # do not use data- prefix
    'size': 'compact',  # do not use data- prefix
    # ...
}

If you need to, you can also override default hCaptcha endpoints:

HCAPTCHA_JS_API_URL = 'https://hcaptcha.com/1/api.js'
HCAPTCHA_VERIFY_URL = 'https://hcaptcha.com/siteverify'

Use proxies:

HCAPTCHA_PROXIES = {
   'http': 'http://127.0.0.1:8000',
}

Change default verification timeout:

HCAPTCHA_TIMEOUT = 5

Usage

Simply add hCaptchaField to your forms:

from hcaptcha_field import hCaptchaField

class Form(forms.Form):
    hcaptcha = hCaptchaField()

You can override the sitekey and other default configuration by passing additional arguments:

from hcaptcha_field import hCaptchaField

class Form(forms.Form):
    hcaptcha = hCaptchaField(sitekey='...', theme='dark', size='compact')

License

The scripts and documentation in this project are released under the BSD-3-Clause License.

django-hcaptcha-field's People

Contributors

tiesjan avatar andrejzbin avatar pitrk avatar jraylan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.