views.py 文件源码

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

项目:waves-demo 作者: lirmm 项目源码 文件源码
def validate_key(self, activation_key):
        try:
            username = signing.loads(
                activation_key,
                salt=settings.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.SignatureExpired:
            self.template_name = "accounts/activation_error.html"
            self.error_reason = "Your code has expired"
            return None
        except signing.BadSignature:
            self.template_name = "accounts/activation_error.html"
            self.error_reason = "Bad activation key"
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号