-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hCaptcha backend as an alternative to reCAPTCHA #2312
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. The idea of using hCaptcha as an alternate backend seems good to me, especially given how easy this looks to support.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2312 +/- ##
==========================================
+ Coverage 46.76% 47.76% +0.99%
==========================================
Files 251 259 +8
Lines 13317 13716 +399
==========================================
+ Hits 6228 6551 +323
- Misses 7089 7165 +76 ☔ View full report in Codecov by Sentry. |
Satisfy lint
Ready for review. Only one backend can ever be active at a given time, however that seems logical. |
captcha = ReCaptchaField(widget=ReCaptchaWidget()) | ||
if CaptchaField is not None: | ||
if ReCaptchaWidget is not None: | ||
captcha = CaptchaField(widget=ReCaptchaWidget()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need this special construction? https://github.com/DMOJ/django-recaptcha2/blob/master/snowpenguin/django/recaptcha2/fields.py#L22 seems to imply that widget=ReCaptchaWidget()
is pointless.
Honestly, at this rate, I am tempted to drop ReCAPTCHA soon, given all the problems I ran into with them and also the fact I had to fork the library...
except ImportError: | ||
ReCaptchaField = None | ||
ReCaptchaWidget = None | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
try: | |
try: |
This PR adds support for an hCaptcha backend powered by
django-hcaptcha-field
. Most additions are duplicated from the existing reCAPTCHA backend as the hCaptcha package is very similar.See https://blog.cloudflare.com/moving-from-recaptcha-to-hcaptcha for possible benefits over reCAPTCHA.