user.py 文件源码

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

项目:python-web-boilerplate 作者: svenstaro 项目源码 文件源码
def generate_auth_token(self):
        """Generate an auth token and save it to the `current_auth_token` column."""
        alphabet = string.ascii_letters + string.digits
        new_auth_token = ''.join(secrets.choice(alphabet) for i in range(32))
        self.current_auth_token = new_auth_token
        self.last_action = datetime.utcnow()
        db.session.add(self)
        db.session.commit()
        return new_auth_token
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号