urls.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:python-webapp-blog 作者: tzshlyt 项目源码 文件源码
def parse_signed_cookie(cookie_str):
    try:
        L = cookie_str.split('-')
        if len(L) != 3:
            return None
        id, expires, md5 = L
        if int(expires) < time.time():
            return None
        user = User.get(id)
        if user is None:
            return None
        if md5 != hashlib.md5('%s-%s-%s-%s' % (id, user.password, expires, _COOKIE_KEY)).hexdigest():
            return None
        return user
    except:
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号