This is a pull request which contains the Django-recaptcah implementation
-- Feature additions/deletions --
Add recaptcha v2 checkbox to comment forms.
(commented) Add reCaptcha v2 invisible and reCaptcha v3 to comment forms.
Create recaptcha app, mainly for organising js files used by recaptcha and overriding templates provided by django-recaptcha.
-- Files/links added/removed --
Add recaptcha app folder that contains templates used for recaptcha widgets and their js files (written in html files).
Add static folder inside recaptcha app, that contains js functions used for reCaptcha v2 checkbox.
-- How to use recaptcha --
Download and install package using pip install django-recaptcha
Add ReCaptchaField to your form class at yourApp/forms.py.
To use checkbox
you do not need to supply public_key or private_key in the parameters, by default it will look for those keys inside settings.py.
add class 'captcha-submit' to the submit button of your form.
add 'disabled' attribute to the button.
checkbox would still work without them. Having them would grey out submit button if checkbox is not ticked.
To use other recaptchas
remove/comment all things added for checkbox, including class 'captcha-submit' and 'disabled' attribute.
To create recaptcha with minimum required parameters:
captcha = ReCaptchaField(
public_key=RECAPTCHA_PUBLIC_KEY_INV,
private_key=RECAPTCHA_PRIVATE_KEY_INV,
widget=ReCaptchaV2Invisible,
label=''
)
You may replace widget value to either ReCaptchaV2Invisible, ReCaptchaV2Checkbox or ReCaptchaV3.
Caveat
You are only allowed to place one recaptcha per page, due to the lib's implementation.
This is a pull request which contains the Django-recaptcah implementation -- Feature additions/deletions --