最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】Flask管理短信验证码

Flask crifan 2875浏览 0评论

Flask管理短信验证码

flask开发restful api系列(5)-短信验证码 – 月儿弯弯0204 – 博客园

Python China — 如何实现短信验证功能?python flask

flask restful api开发 – 随笔分类 – 月儿弯弯0204 – 博客园

flask开发restful api系列(5)-短信验证码 – 月儿弯弯0204 – 博客园

python实现发送和获取手机短信验证码-python教程-脚本之家-源码库|专注为中国站长提供免费商业网站源码下载!

GitHub – endsh/chiki: 基于Flask的应用层框架

通用扩展 — chiki 1.1.0 文档

用:

def post(self):
    args = self.reqparse.parse_args()
    gLog.debug("args=%s", args)
    type = args[‘type’]
    gLog.debug("type=%s", type)
    if "phone" in args:
        phone = args["phone"]
        gLog.debug("phone=%s", phone)
    chars = [‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’]
    randomNumList = random.choice(chars), random.choice(chars), random.choice(chars), random.choice(chars), random.choice(chars), random.choice(chars)
    gLog.debug("randomNumList=%s", randomNumList)
    smsCodeStr = "".join(randomNumList)
    gLog.debug("smsCodeStr=%s", smsCodeStr)
    respJsonDict = {
        "message"   : "OK",
        "code"      : 200,
        "smscode"   : smsCodeStr
    }
    gLog.debug("respJsonDict=%s", respJsonDict)
    return respJsonDict

已经可以随机生成验证码了:

现在要去搞清楚:

如何存储验证码

根据其中一个帖子说,存在redis,且设置过期时间

flask sms code storage

flask verify code storage

flask – Query database to send SMS – Stack Overflow

flask 短信验证码 存储

登陆验证手机短信验证码方案 – SegmentFault

【已解决】Flask中用redis保存和管理验证码

转载请注明:在路上 » 【记录】Flask管理短信验证码

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.158 seconds, using 22.16MB memory