This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<label>Verify you're human:</label> | |
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=YOUR_RECAPTCH_PUBLIC_KEY_HERE"> | |
</script> | |
<noscript> | |
<iframe src="http://www.google.com/recaptcha/api/noscript?k=YOUR_RECAPTCH_PUBLIC_KEY_HERE" height="300" width="500" frameborder="0"></iframe><br> | |
<textarea name="recaptcha_challenge_field" rows="3" cols="40"> | |
</textarea> | |
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"> | |
</noscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_captcha(self, form): | |
recaptcha_challenge_field = self.request.get("recaptcha_challenge_field") | |
recaptcha_response_field = self.request.get("recaptcha_response_field") | |
remote_ip = self.request.remote_addr | |
recaptcha_private_key = 'MY_PRIVATE_KEY' # put recaptcha private key here | |
recaptcha_post_data = {"privatekey": recaptcha_private_key, | |
"remoteip": remote_ip, | |
"challenge": recaptcha_challenge_field, | |
"response": recaptcha_response_field} |