From c88b6d62b9b66b7ba80ff9644f87594641f00ed7 Mon Sep 17 00:00:00 2001 From: jordan Date: Thu, 15 Mar 2012 01:42:07 +0000 Subject: [PATCH] update the recaptcha module, make it use the proper interfaces git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1232 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum_modules/recaptcha/lib/captcha.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/forum_modules/recaptcha/lib/captcha.py b/forum_modules/recaptcha/lib/captcha.py index 03323ee..c165dc9 100644 --- a/forum_modules/recaptcha/lib/captcha.py +++ b/forum_modules/recaptcha/lib/captcha.py @@ -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 -- 2.39.5