def get_code(request): ca = Captcha(request) #ca.words = ['hello', 'world', 'helloworld'] ca.type = 'number' #or word ca.img_width = 150 ca.img_height = 30 return ca.display()
def code(request): ca=Captcha(request) figures = [2,3,4,5,6,7,8,9] ca.words = [''.join(str(random.sample(figures,1)[0]) for i in range(0,4))] ca.type= 'word' ca.img_height = 30 ca.img_width = 100 return ca.display()
def verifycode(request): figures = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ca = Captcha(request) ca.words = [''.join([str(random.sample(figures, 1)[0]) for i in range(0, 4)])] ca.type = 'word' ca.img_width = 60 ca.img_height = 20 return ca.display()
def code(request): ca = Captcha(request) ca.words = ['google', 'twitter', 'facebook', 'tomcat', 'nginx'] ca_mode = request.GET.get('mode', 'word').lower() assert ca_mode in ['number', 'word', 'four_number'] ca.mode = ca_mode return ca.display()
def code(request): figures = [1,2,3,4,5,6,7,8,9,0,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ca = Captcha(request) ca.words = [''.join([str(random.sample(figures,1)[0]) for i in range(0,5)])] ca.type = 'word' ca.img_width = 150 ca.img_height = 35 return ca.display()
def code(request): ca = Captcha(request) ca.words = ['hello','world','helloworld'] ca_type = request.GET.get('type', 'word').lower() assert ca_type in ['number', 'word'] ca.type = ca_type return ca.display()
def getVerificationCode(request): ca = Captcha(request) figures = [2, 3, 4, 5, 6, 7, 8, 9] ca.img_width = 103 ca.img_height = 30 ca.words = [''.join([str(random.sample(figures, 1)[0]) for i in range(0, 4)])] ca.type = 'word' # print ca.words return ca.display()
def code(request): nums = [2, 3, 4, 5, 6, 7, 8, 9] ca = Captcha(request) ca.words = [ ''.join([str(random.sample(nums, 1)[0]) for i in xrange(0, 4)]) ] ca.type = 'word' return ca.display()
def code(request): ca = Captcha(request) figures = [2, 3, 4, 5, 6, 7, 8, 9] ca.words = [ ''.join(str(random.sample(figures, 1)[0]) for i in range(0, 4)) ] ca.type = 'word' ca.img_height = 30 ca.img_width = 100 return ca.display()
def code(request): def gene_text(): source = 'ABCDEFGHKMNPRSTUVWXYZabcdefghkmnpqrstuvwxyz23456789' return ''.join(random.sample(list(source), 4)) ca = Captcha(request) ca.words = [gene_text()] ca.type = "word" return ca.display()
def get(self, request): from DjangoCaptcha import Captcha import random l = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" s = random.sample(l, 4) ca = Captcha(request) ca.words = [''.join(s)] ca.img_width = 120 ca.img_height = 30 ca.type = 'word' self.is_weixin() return ca.display()
def captcha(request): figures = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] #figures = [chr(i) for i in range(97,123)] ca = Captcha(request) ca.words = [ ''.join([str(random.sample(figures, 1)[0]) for i in range(0, 4)]) ] #ca.type = 'number' #数学运算 ca.type = 'word' #字符串 ca.img_width = 80 ca.img_height = 20 return ca.display()
def ValidCode(request): mod = request.REQUEST.get("a", "") if mod <> "check": ca = Captcha(request) # ca.words = ['hello','world','helloworld'] ca.type = 'number' # ca.type = 'word' ca.img_width = 140 ca.img_height = 30 return ca.display() else: _code = request.GET.get('code') ca = Captcha(request) if ca.check(_code): J = Json_Code(data='', msg="验证成功", error=0) else: J = Json_Code(data='', msg="验证失败", error=1) return HttpResponse(J)
def verify(request): ca = Captcha(request) ca.words = ['share','reddit','fqsq','funqiu'] ca.type = 'word' return ca.display()
def code(request): ca = Captcha(request) ca.worlds = ["hello", "world", "helloworld"] ca.type = "number" ca.type = "word" return ca.display()
def captcha(request): ca = Captcha(request) ca.words = ['a','b','c'] ca.type = 'number' #ca.type = 'word' return ca.display()
def code(req): ca = Captcha(req) ca.type = 'number' return ca.display()
def captcha(request): ca = Captcha(request) ca.mode = 'four_number' ca.img_width = 100 ca.img_height = 30 return ca.display()
def code(request): ca = Captcha(request) ca.words = ['hello', 'world', 'apple', 'orange', 'banana', 'xiaobei', 'beibei'] ca.type = 'number' return ca.display()
def captcha_view(request): ca = Captcha(request) ca.img_width = 100 ca.type = 'word' return ca.display()
def code(request): '''生成验证码''' ca = Captcha(request) return ca.display()
def captcha(request): ca = Captcha(request) return ca.display()