Пример #1
0
 def clean_captcha(self):
     # 获取验证码 name="captcha"
     captcha = self.cleaned_data.get('captcha', None)
     # 如果返回True 则返回验证码
     if not Captcha.check_captcha(captcha):
         raise forms.ValidationError(u'验证码错误!')
     else:
         return captcha
Пример #2
0
    def clean_captcha(self):
        captcha = self.cleaned_data.get('captcha')
        if not Captcha.check_captcha(captcha):
            raise forms.ValidationError(u'验证码错误')

        return captcha
Пример #3
0
 def validate_graph_captcha(self,field):
     graph_captcha = field.data
     if not Captcha.check_captcha(graph_captcha):
         raise wtforms.ValidationError(u'图形验证码错误')
Пример #4
0
 def validate_captcha(self,field):
     captcha = field.data
     if not Captcha.check_captcha(captcha):
         wtforms.ValidationError(u'验证码错误!')