当前位置: 首页>>代码示例>>Python>>正文


Python PasswordResetTokenGenerator._make_token_with_timestamp方法代码示例

本文整理汇总了Python中django.contrib.auth.tokens.PasswordResetTokenGenerator._make_token_with_timestamp方法的典型用法代码示例。如果您正苦于以下问题:Python PasswordResetTokenGenerator._make_token_with_timestamp方法的具体用法?Python PasswordResetTokenGenerator._make_token_with_timestamp怎么用?Python PasswordResetTokenGenerator._make_token_with_timestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.contrib.auth.tokens.PasswordResetTokenGenerator的用法示例。


在下文中一共展示了PasswordResetTokenGenerator._make_token_with_timestamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_date_length

# 需要导入模块: from django.contrib.auth.tokens import PasswordResetTokenGenerator [as 别名]
# 或者: from django.contrib.auth.tokens.PasswordResetTokenGenerator import _make_token_with_timestamp [as 别名]
    def test_date_length(self):
        """
        Overly long dates, which are a potential DoS vector, aren't allowed.
        """
        user = User.objects.create_user('ima1337h4x0r', '[email protected]', 'p4ssw0rd')
        p0 = PasswordResetTokenGenerator()

        # This will put a 14-digit base36 timestamp into the token, which is too large.
        with self.assertRaises(ValueError):
            p0._make_token_with_timestamp(user, 175455491841851871349)
开发者ID:Hwesta,项目名称:django,代码行数:12,代码来源:test_tokens.py

示例2: test_date_length

# 需要导入模块: from django.contrib.auth.tokens import PasswordResetTokenGenerator [as 别名]
# 或者: from django.contrib.auth.tokens.PasswordResetTokenGenerator import _make_token_with_timestamp [as 别名]
    def test_date_length(self):
        """
        Make sure we don't allow overly long dates, causing a potential DoS.
        """
        user = User.objects.create_user('ima1337h4x0r', '[email protected]', 'p4ssw0rd')
        p0 = PasswordResetTokenGenerator()

        # This will put a 14-digit base36 timestamp into the token, which is too large.
        tk1 = p0._make_token_with_timestamp(user, 175455491841851871349)
        self.assertFalse(p0.check_token(user, tk1))
开发者ID:0xmilk,项目名称:appscale,代码行数:12,代码来源:tokens.py


注:本文中的django.contrib.auth.tokens.PasswordResetTokenGenerator._make_token_with_timestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。