Example #1
0
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()
Example #2
0
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()
Example #3
0
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()
Example #4
0
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()
Example #5
0
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()
Example #6
0
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()
Example #8
0
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()
Example #9
0
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()
Example #10
0
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()
Example #11
0
 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()
Example #12
0
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()
Example #13
0
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)
Example #14
0
def verify(request):
    ca =  Captcha(request)
    ca.words = ['share','reddit','fqsq','funqiu']
    ca.type = 'word'
    return ca.display()
Example #15
0
def code(request):
    ca = Captcha(request)
    ca.worlds = ["hello", "world", "helloworld"]
    ca.type = "number"
    ca.type = "word"
    return ca.display()
Example #16
0
def captcha(request):
    ca =  Captcha(request)
    ca.words = ['a','b','c']
    ca.type = 'number'
    #ca.type = 'word'
    return ca.display()
Example #17
0
def code(req):
    ca =  Captcha(req)
    ca.type = 'number'
    return ca.display()
Example #18
0
def code(request):
    ca = Captcha(request)
    ca.words = ['hello', 'world', 'apple', 'orange', 'banana', 'xiaobei', 'beibei']
    ca.type =  'number'
    return ca.display()
Example #19
0
def code(req):
    ca = Captcha(req)
    ca.type = 'number'
    return ca.display()
Example #20
0
def captcha_view(request):
    ca = Captcha(request)
    ca.img_width = 100
    ca.type = 'word'
    return ca.display()