Esempio n. 1
0
def get_captcha():
    gt = GeetestLib(id, key)
    if gt.pre_process():
        res_str = gt.success_pre_process()
        gt.set_gtserver_session(session.__setitem__, 1, gt.challenge)
    else:
        res_str = gt.fail_pre_process()
        gt.set_gtserver_session(session.__setitem__, 0, gt.challenge)
    return res_str
Esempio n. 2
0
def get_captcha():
    gt =  GeetestLib(id, key)
    if gt.pre_process():
        res_str = gt.success_pre_process()
        gt.set_gtserver_session(session.__setitem__, 1, gt.challenge)
    else:
        res_str = gt.fail_pre_process()
        gt.set_gtserver_session(session.__setitem__, 0, gt.challenge)
    return res_str
Esempio n. 3
0
def validate_capthca():
    challenge = request.form['geetest_challenge']
    validate = request.form['geetest_validate']
    seccode = request.form['geetest_seccode']
    gt = GeetestLib(id, key)
    gt.challenge = gt.get_gtserver_challenge(session.__getitem__)
    gt_server_status = gt.get_gtserver_session(session.__getitem__)
    if not gt.challenge == challenge[0:32]:
        return "fail"
    if gt_server_status == 1:
        result = gt.post_validate(challenge, validate, seccode)
    else:
        result = gt.failback_validate(challenge, validate, seccode)
    return result
Esempio n. 4
0
def validate_capthca():
    challenge = request.form['geetest_challenge']
    validate = request.form['geetest_validate']
    seccode = request.form['geetest_seccode']
    gt = GeetestLib(id,key)
    gt.challenge = gt.get_gtserver_challenge(session.__getitem__)
    gt_server_status = gt.get_gtserver_session(session.__getitem__)
    if not gt.challenge == challenge[0:32]:
        return "fail"
    if gt_server_status == 1:
        result = gt.post_validate(challenge, validate, seccode)
    else:
        result = gt.failback_validate(challenge, validate, seccode)
    return result