user_model.py 文件源码

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

项目:suite 作者: Staffjoy 项目源码 文件源码
def get_auth_token(self):
        """Cookie info. Must be secure."""
        s = Serializer(current_app.config["SECRET_KEY"],
                       current_app.config["COOKIE_EXPIRATION"])
        current_app.logger.debug("Generating auth token for user %s" % self.id)

        if not self.is_authenticated:
            raise Exception("User not authenticated")

        return s.dumps({
            "user_id":
            self.id,
            "session_id":
            SessionCache.create_session(
                self.id, expiration=current_app.config["COOKIE_EXPIRATION"])
        })
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号