def clean(self, val):
     super(SolveMediaCaptchaField, self).clean(val['response'])
     sm = SolveMedia(settings.SM_CKEY, settings.SM_VKEY, settings.SM_HKEY)
     result = sm.check_answer(self.__getRequestIP(), val['challenge'], val['response'])
     if not result['is_valid']:
         raise forms.ValidationError("Error: " + result['error'].capitalize())
     return val['response']
Exemple #2
0
 def clean(self, val):
     super(SolveMediaCaptchaField, self).clean(val["response"])
     sm = SolveMedia(settings.SM_CKEY, settings.SM_VKEY, settings.SM_HKEY)
     result = sm.check_answer(
         self._getRequestIP(), val["challenge"].encode("utf-8"), val["response"].encode("utf-8")
     )
     if not result["is_valid"]:
         raise forms.ValidationError("Error: " + result["error"].capitalize())
     return val["response"]
Exemple #3
0
 def clean(self, val):
     super(SolveMediaCaptchaField, self).clean(val['response'])
     sm = SolveMedia(settings.SM_CKEY, settings.SM_VKEY, settings.SM_HKEY)
     result = sm.check_answer(self._getRequestIP(),
                              val['challenge'].encode('utf-8'),
                              val['response'].encode('utf-8'))
     if not result['is_valid']:
         raise forms.ValidationError("Error: " +
                                     result['error'].capitalize())
     return val['response']
 def render(self, name, value, attrs=None):
     sm = SolveMedia(settings.SM_CKEY, settings.SM_VKEY, settings.SM_HKEY)
     return mark_safe(sm.get_html(usessl=True) + "<br>")
Exemple #5
0
 def render(self, name, value, attrs=None):
     sm = SolveMedia(settings.SM_CKEY, settings.SM_VKEY, settings.SM_HKEY)
     return mark_safe(sm.get_html() + "<br>")