views.py 文件源码

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

项目:django-learning 作者: adoggie 项目源码 文件源码
def validate_key(self, activation_key):
        """
        Verify that the activation key is valid and within the
        permitted activation time window, returning the username if
        valid or ``None`` if not.

        """
        try:
            username = signing.loads(
                activation_key,
                salt=REGISTRATION_SALT,
                max_age=settings.ACCOUNT_ACTIVATION_DAYS * 86400
            )
            return username
        # SignatureExpired is a subclass of BadSignature, so this will
        # catch either one.
        except signing.BadSignature:
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号