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


Python UserProfile.check_password方法代码示例

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


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

示例1: test_browserid_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
    def test_browserid_password(self):
        for source in amo.LOGIN_SOURCE_BROWSERIDS:
            u = UserProfile(password=self.utf, source=source)
            assert u.check_password('foo')

        u = UserProfile(password=self.utf, source=amo.LOGIN_SOURCE_UNKNOWN)
        assert not u.check_password('foo')
开发者ID:KKcorps,项目名称:zamboni,代码行数:9,代码来源:test_models.py

示例2: test_empty_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_empty_password(self):
     profile = UserProfile(password=None)
     assert profile.has_usable_password() is False
     assert not check_password(None, profile.password)
     assert not profile.check_password(None)
     profile = UserProfile(password='')
     assert profile.has_usable_password() is False
     assert not check_password('', profile.password)
     assert not profile.check_password('')
开发者ID:aniketkudale,项目名称:olympia,代码行数:11,代码来源:test_models.py

示例3: test_persona_sha512_base64_maybe_not_latin1

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_persona_sha512_base64_maybe_not_latin1(self):
     passwd = u'fo\xf3'
     hsh = hashlib.sha512(self.bytes_ + passwd.encode('latin1')).hexdigest()
     u = UserProfile(password='sha512+base64$%s$%s' %
                     (encodestring(self.bytes_), hsh))
     assert u.check_password(self.utf) is False
     assert u.has_usable_password() is True
开发者ID:arpitnigam,项目名称:olympia,代码行数:9,代码来源:test_models.py

示例4: test_persona_sha512_md5_base64

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_persona_sha512_md5_base64(self):
     md5 = hashlib.md5('password').hexdigest()
     hsh = hashlib.sha512(self.bytes_ + md5).hexdigest()
     u = UserProfile(password='sha512+MD5+base64$%s$%s' %
                     (encodestring(self.bytes_), hsh))
     assert u.check_password('password') is True
     assert u.has_usable_password() is True
开发者ID:arpitnigam,项目名称:olympia,代码行数:9,代码来源:test_models.py

示例5: test_valid_old_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_valid_old_password(self):
     hsh = hashlib.md5(encoding.smart_str(self.utf)).hexdigest()
     u = UserProfile(password=hsh)
     assert u.check_password(self.utf) is True
     # Make sure we updated the old password.
     algo, salt, hsh = u.password.split('$')
     eq_(algo, 'sha512')
     eq_(hsh, get_hexdigest(algo, salt, self.utf))
开发者ID:BavarianTomcat,项目名称:olympia,代码行数:10,代码来源:test_models.py

示例6: test_valid_old_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_valid_old_password(self):
     hsh = hashlib.md5('sekrit').hexdigest()
     u = UserProfile(password=hsh)
     assert u.check_password('sekrit') is True
     # Make sure we updated the old password.
     algo, salt, hsh = u.password.split('$')
     eq_(algo, 'sha512')
     eq_(hsh, get_hexdigest(algo, salt, 'sekrit'))
开发者ID:chowse,项目名称:zamboni,代码行数:10,代码来源:test_models.py

示例7: test_persona_sha512_base64_maybe_utf8

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_persona_sha512_base64_maybe_utf8(self):
     hsh = hashlib.sha512(self.bytes_ + self.utf.encode('utf8')).hexdigest()
     u = UserProfile(password='sha512+base64$%s$%s' %
                     (encodestring(self.bytes_), hsh))
     assert u.check_password(self.utf) is True
     assert u.has_usable_password() is True
开发者ID:arpitnigam,项目名称:olympia,代码行数:8,代码来源:test_models.py

示例8: test_valid_new_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_valid_new_password(self):
     u = UserProfile()
     u.set_password(self.utf)
     assert u.check_password(self.utf) is True
     assert u.has_usable_password() is True
开发者ID:arpitnigam,项目名称:olympia,代码行数:7,代码来源:test_models.py

示例9: test_invalid_new_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_invalid_new_password(self):
     u = UserProfile()
     u.set_password(self.utf)
     assert u.check_password('wrong') is False
     assert u.has_usable_password() is True
开发者ID:arpitnigam,项目名称:olympia,代码行数:7,代码来源:test_models.py

示例10: test_invalid_old_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_invalid_old_password(self):
     u = UserProfile(password=self.utf)
     assert u.check_password(self.utf) is False
     assert u.has_usable_password() is True
开发者ID:arpitnigam,项目名称:olympia,代码行数:6,代码来源:test_models.py

示例11: test_persona_sha512_base64

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_persona_sha512_base64(self):
     hsh = hashlib.sha512(self.bytes_ + 'password').hexdigest()
     u = UserProfile(password='sha512+base64$%s$%s' %
                     (encodestring(self.bytes_), hsh))
     assert u.check_password('password') is True
开发者ID:BavarianTomcat,项目名称:olympia,代码行数:7,代码来源:test_models.py

示例12: test_invalid_old_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_invalid_old_password(self):
     u = UserProfile(password=self.utf)
     assert u.check_password(self.utf) is False
开发者ID:BavarianTomcat,项目名称:olympia,代码行数:5,代码来源:test_models.py

示例13: test_valid_new_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_valid_new_password(self):
     u = UserProfile()
     u.set_password('sekrit')
     assert u.check_password('sekrit') is True
开发者ID:chowse,项目名称:zamboni,代码行数:6,代码来源:test_models.py

示例14: test_invalid_new_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_invalid_new_password(self):
     u = UserProfile()
     u.set_password('sekrit')
     assert u.check_password('wrong') is False
开发者ID:chowse,项目名称:zamboni,代码行数:6,代码来源:test_models.py

示例15: test_invalid_old_password

# 需要导入模块: from users.models import UserProfile [as 别名]
# 或者: from users.models.UserProfile import check_password [as 别名]
 def test_invalid_old_password(self):
     u = UserProfile(password='sekrit')
     assert u.check_password('sekrit') is False
开发者ID:chowse,项目名称:zamboni,代码行数:5,代码来源:test_models.py


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