示例#1
0
    def test_date_length(self):
        """
        Overly long dates, which are a potential DoS vector, aren't allowed.
        """
        user = User.objects.create_user('ima1337h4x0r', '*****@*****.**', '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)
示例#2
0
    def test_date_length(self):
        """
        Make sure we don't allow overly long dates, causing a potential DoS.
        """
        user = User.objects.create_user('ima1337h4x0r', '*****@*****.**', '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)
示例#3
0
文件: tokens.py 项目: 0xmilk/appscale
    def test_date_length(self):
        """
        Make sure we don't allow overly long dates, causing a potential DoS.
        """
        user = User.objects.create_user('ima1337h4x0r', '*****@*****.**', '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))