incorrect-captcha-sol

237 views
Skip to first unread message

Erin Elkins

unread,
Feb 18, 2013, 12:45:25 PM2/18/13
to reca...@googlegroups.com
Hi, this is my first time posting in this group. I'm getting an expected error (the challenge and response fields are not passing. Very strange) when submitting my form.
 
(using the default PHP script provided by recaptcha to generate)
 
<form id="orderForm" action="formentry.php" method="post" name="orderForm" onsubmit="return validate_form(this)">
<!-- lots of input fields in a table; however, the table ends and the recaptcha goes after-->
<script type="text/javascript" src=http://www.google.com/recaptcha/api/challenge?k=my-public-key-is-here></script>
<noscript>
<iframe src=http://www.google.com/recaptcha/api/noscript?k=my-public-key-is-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>
<input type="submit" name="submitButtonName" value="Submit Request">
</form>
 
Any ideas?  Would it help if I got new keys?  Do keys expire??
 

Adrian Godong

unread,
Feb 18, 2013, 12:47:39 PM2/18/13
to reca...@googlegroups.com
Did you implement this part:
https://developers.google.com/recaptcha/docs/verify
> --
> You received this message because you are subscribed to the Google Groups
> "reCAPTCHA" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to recaptcha+...@googlegroups.com.
> To post to this group, send email to reca...@googlegroups.com.
> Visit this group at http://groups.google.com/group/recaptcha?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Adrian Godong
adrian...@gmail.com

Erin Elkins

unread,
Feb 18, 2013, 1:06:43 PM2/18/13
to reca...@googlegroups.com
Hi Adrian, thank you for your reply.  I have implemented a verify but the challenge and response fields are not passing and I'm not sure why.

cvkluka

unread,
Mar 6, 2013, 6:51:48 PM3/6/13
to reca...@googlegroups.com
I have the same problem with python template substitution. If my python cgi uses a print statement for the recaptcha frame inside the script there's no problem. But I need to use a (python string) template for my html form since it's not practical to put longer print statements inside cgi scripts.

This code prints all the form fields EXCEPT recaptcha challenge and response:

form = cgi.FieldStorage()
fields = {}

def process_form(**kw):

    form_list = ['recaptcha_challenge_field', 'recaptcha_response_field', 'Last_Name', 'First_Name']
   
    fields = kw.get('fields', {}) # dict of form field names & values
    errors = []
...
 if form.getvalue('Submit'):
       
        response = captcha.submit(
            fields['recaptcha_challenge_field'],
            fields['recaptcha_response_field'],
            private_key,
            remote_addr)
       
        if response.error_code:
            errors.append("display_recaptcha?error=%s"%response.error_code)
            errors.append(fields['recaptcha_response_field'])
            # check to see if form fields are processed
            for field in fields:
                print field, fields[field]
  ...
 try:
       t = Template(open(template_form).read())
       print t.substitute(title_msg=title_msg +'<br/>'.join(errors), **fields)

This is very frustrating because it worked for python 2.4 and 2.5, but the same code fails to pass recaptcha challenge/response values in python 2.7. Is there a solution? Is there another group I should post this problem to?

cvkluka

unread,
Mar 6, 2013, 7:13:49 PM3/6/13
to reca...@googlegroups.com
In addition, I tried changing the form action to point to http://www.google.com/recaptcha/api/verify and got this response:
false
invalid-site-private-key
However the private key in my cgi script matches the one on my google recaptcha admin page exactly. So I presume that nothing was transmitted. Since the same problem occurs when I point the form action to a localhost url, the problem is not with my firewall. There should be a python solution to this.
Reply all
Reply to author
Forward
0 new messages