]> git.openstreetmap.org Git - osqa.git/commitdiff
update the recaptcha module, make it use the proper interfaces
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 15 Mar 2012 01:42:07 +0000 (01:42 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 15 Mar 2012 01:42:07 +0000 (01:42 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1232 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum_modules/recaptcha/lib/captcha.py

index 03323eeaaaecaef16369d3753946e4b6bdb26316..c165dc929aab1f2fedf3c339087d42e5265ba704 100644 (file)
@@ -1,8 +1,8 @@
 import urllib2, urllib
 
-API_SSL_SERVER="https://api-secure.recaptcha.net"
-API_SERVER="http://api.recaptcha.net"
-VERIFY_SERVER="api-verify.recaptcha.net"
+API_SSL_SERVER="https://www.google.com/recaptcha/api"
+API_SERVER="http://www.google.com/recaptcha/api"
+VERIFY_SERVER="www.google.com"
 
 class RecaptchaResponse(object):
     def __init__(self, is_valid, error_code=None):
@@ -66,20 +66,20 @@ def submit (recaptcha_challenge_field,
         return s
 
     params = urllib.urlencode ({
-            'privatekey': encode_if_necessary(private_key),
-            'remoteip' :  encode_if_necessary(remoteip),
-            'challenge':  encode_if_necessary(recaptcha_challenge_field),
-            'response' :  encode_if_necessary(recaptcha_response_field),
-            })
+        'privatekey': encode_if_necessary(private_key),
+        'remoteip' :  encode_if_necessary(remoteip),
+        'challenge':  encode_if_necessary(recaptcha_challenge_field),
+        'response' :  encode_if_necessary(recaptcha_response_field),
+        })
 
     request = urllib2.Request (
-        url = "http://%s/verify" % VERIFY_SERVER,
+        url = "http://%s/recaptcha/api/verify" % VERIFY_SERVER,
         data = params,
         headers = {
             "Content-type": "application/x-www-form-urlencoded",
             "User-agent": "reCAPTCHA Python"
-            }
-        )
+        }
+    )
 
     httpresp = urllib2.urlopen (request)
 
@@ -91,6 +91,4 @@ def submit (recaptcha_challenge_field,
     if (return_code == "true"):
         return RecaptchaResponse (is_valid=True)
     else:
-        return RecaptchaResponse (is_valid=False, error_code = return_values [1])
-
-
+        return RecaptchaResponse (is_valid=False, error_code = return_values [1])
\ No newline at end of file