Reputation: 45
I have been asked to add a Captcha field to the login page of a system built using Django.
My problem is that the system is written with hand-crafted HTML templates rather than with Django forms so the interface presented in the Simple Captcha documentation doesn't seem to apply. Rewriting the login page does not seem feasible at this point.
Is there a way to weave this package into custom HTML code by adding a captcha field?
Alternatively, is there another package that would be easy to use with custom HTML?
Upvotes: 2
Views: 1697
Reputation: 55972
Yes reCaptcha
is trivial to setup on a page with custom HTML
You load the captcha in your html (in an iframe I believe) and then check to make sure that the correct answer was posted to your view. Using the python library is like:
response = captcha.submit(
req.args['recaptcha_challenge_field'],
req.args['recaptcha_response_field'],
self.private_key,
req.remote_addr,
)
if response.is_valid:
# captcha was passed
Example was ripped from:
How to use Python plugin reCaptcha client for validation?
Another recaptcha python client is here
Upvotes: 1