[ckan-changes] commit/ckan: 3 new changesets

Bitbucket commits-noreply at bitbucket.org
Mon Sep 5 18:21:51 UTC 2011


3 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/9b81fbfbb878/
changeset:   9b81fbfbb878
branch:      feature-1307-recaptcha
user:        zephod
date:        2011-09-05 20:19:47
summary:     [recaptcha][xs]: Brown paper bag error.
affected #:  1 file (1.1 KB)

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckan/lib/captcha.py	Mon Sep 05 19:19:47 2011 +0100
@@ -0,0 +1,31 @@
+from pylons import config
+
+import urllib
+import urllib2
+
+def check_recaptcha(request):
+    '''Check a user's recaptcha submission is valid, and raise CaptchaError on failure.'''
+    recaptcha_private_key = config.get('ckan.recaptcha.privatekey', '')
+    if not recaptcha_private_key:
+        # Recaptcha not enabled
+        return
+    
+    client_ip_address = request.environ.get('REMOTE_ADDR', 'Unknown IP Address')
+    recaptcha_challenge_field = request.params.get('recaptcha_challenge_field')
+    recaptcha_response_field = request.params.get('recaptcha_response_field')
+
+    recaptcha_server_name = 'http://api-verify.recaptcha.net/verify'
+
+    params = urllib.urlencode(dict(privatekey=recaptcha_private_key,
+                                   remoteip=client_ip_address,
+                                   challenge=recaptcha_challenge_field,
+                                   response=recaptcha_response_field))
+    f = urllib2.urlopen(recaptcha_server_name, params)
+    data = f.read()
+    f.close()
+    if not data.lower().startswith('true'):
+        raise CaptchaError()
+
+class CaptchaError(ValueError):
+    pass
+


http://bitbucket.org/okfn/ckan/changeset/1c749d68515d/
changeset:   1c749d68515d
branch:      feature-1307-recaptcha
user:        zephod
date:        2011-09-05 20:20:14
summary:     [close-branch]:
affected #:  0 files (0 bytes)

http://bitbucket.org/okfn/ckan/changeset/cbd6677ec41e/
changeset:   cbd6677ec41e
user:        zephod
date:        2011-09-05 20:21:02
summary:     [merge,from-branch]: Re-merging completed recaptcha branch.
affected #:  1 file (1.1 KB)

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ckan/lib/captcha.py	Mon Sep 05 19:21:02 2011 +0100
@@ -0,0 +1,31 @@
+from pylons import config
+
+import urllib
+import urllib2
+
+def check_recaptcha(request):
+    '''Check a user's recaptcha submission is valid, and raise CaptchaError on failure.'''
+    recaptcha_private_key = config.get('ckan.recaptcha.privatekey', '')
+    if not recaptcha_private_key:
+        # Recaptcha not enabled
+        return
+    
+    client_ip_address = request.environ.get('REMOTE_ADDR', 'Unknown IP Address')
+    recaptcha_challenge_field = request.params.get('recaptcha_challenge_field')
+    recaptcha_response_field = request.params.get('recaptcha_response_field')
+
+    recaptcha_server_name = 'http://api-verify.recaptcha.net/verify'
+
+    params = urllib.urlencode(dict(privatekey=recaptcha_private_key,
+                                   remoteip=client_ip_address,
+                                   challenge=recaptcha_challenge_field,
+                                   response=recaptcha_response_field))
+    f = urllib2.urlopen(recaptcha_server_name, params)
+    data = f.read()
+    f.close()
+    if not data.lower().startswith('true'):
+        raise CaptchaError()
+
+class CaptchaError(ValueError):
+    pass
+

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list