models.py 文件源码

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

项目:do-portal 作者: certeu 项目源码 文件源码
def get_auth_token(self, last_totp=None):
        """Think of :class:`URLSafeTimedSerializer` `salt` parameter as
        namespace instead of salt. `The salt explained:
        <https://pythonhosted.org/itsdangerous/#the-salt>`_.
        """
        data = [self.email, self._password, str(self.id)]
        if last_totp:
            data.append(last_totp)
        s = URLSafeTimedSerializer(
            current_app.config['SECRET_KEY'],
            salt='user-auth',
            signer_kwargs=dict(
                key_derivation='hmac',
                digest_method=hashlib.sha256)
        )
        return s.dumps(data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号