Browse Source

removed dependency on recaptcha-client

Rafał Pitoń 9 years ago
parent
commit
8f132fc93a
2 changed files with 5 additions and 10 deletions
  1. 0 1
      misago/project_template/requirements.txt
  2. 5 9
      misago/users/captcha.py

+ 0 - 1
misago/project_template/requirements.txt

@@ -13,6 +13,5 @@ path.py==7.0
 pillow==2.7.0
 psycopg2==2.5.4
 pytz
-recaptcha-client
 requests<3
 unidecode

+ 5 - 9
misago/users/captcha.py

@@ -1,15 +1,11 @@
 import requests
 
-from recaptcha.client.captcha import displayhtml, submit as submit_recaptcha
-from django.utils.translation import ugettext_lazy as _
+from django.core.exceptions import ValidationError
+from django.utils.translation import ugettext as _
 
 from misago.conf import settings
-from misago.core import forms
 
 
-"""
-Captcha tests
-"""
 def recaptcha_test(request):
     r = requests.post('https://www.google.com/recaptcha/api/siteverify', data={
         'secret': settings.recaptcha_secret_key,
@@ -20,9 +16,9 @@ def recaptcha_test(request):
     if r.status_code == 200:
         response_json = r.json()
         if not response_json.get('success'):
-            raise forms.ValidationError(_("Please try again."))
+            raise ValidationError(_("Please try again."))
     else:
-        raise forms.ValidationError(_("Failed to contact reCAPTCHA API."))
+        raise ValidationError(_("Failed to contact reCAPTCHA API."))
 
 
 def qacaptcha_test(request):
@@ -32,7 +28,7 @@ def qacaptcha_test(request):
         if answer == predefined_answer:
             break
     else:
-        raise forms.ValidationError(_("Entered answer is incorrect."))
+        raise ValidationError(_("Entered answer is incorrect."))
 
 
 def nocaptcha_test(request):