Ejemplo n.º 1
0
def sms_captcha(request):
    """短信验证码"""
    code = Captcha.gene_text()
    print('code:', code)
    # 获取方式是/account/sms_captcha/?telephone=12345678900
    telephone = request.GET.get('telephone')
    aliyun.send_sms(telephone, code=code)  # 前端会用到该参数
    print(telephone, code)
    request.session['sms_captcha'] = code
    return HttpResponse('success')
Ejemplo n.º 2
0
def sms_captcha(request):
    code = Captcha.gene_text()
    # /accoutn/sms_captcha/?telephone=12345678900
    telephone = request.GET.get('telephone')
    request.session['sms_captcha'] = code
    result = aliyun.send_sms(telephone, code=code)
    print('短信验证码:%s' % code)
    return HttpResponse('success')
Ejemplo n.º 3
0
def sms_captcha(request):
    code = Captcha.gene_number()
    telephone = request.GET.get('telephone')

    request.session['sms_captcha'] = code

    result = aliyun.send_sms(telephone,code=code)
    print(code)
    return HttpResponse('success')
Ejemplo n.º 4
0
def sms_captcha():
    telephone = flask.request.args.get('telephone')
    if not telephone:
        return xtjson.json_params_error(message='必须指定手机号码!')

    if xtcache.get(telephone):
        return xtjson.json_params_error(message='1分钟内请勿重复发送!')

    code = Captcha.gene_text_num()
    # /accoutn/sms_captcha/?telephone=12345678900
    # telephone = flask.request.form.get('telephone')
    result = aliyun.send_sms(telephone, code=code)
    print(result)
    if result:
        xtcache.set(telephone, code)
        return xtjson.json_result()
    else:
        return xtjson.json_server_error()