本文整理汇总了Python中privacyidea.lib.tokens.emailtoken.EmailTokenClass.set_pin方法的典型用法代码示例。如果您正苦于以下问题:Python EmailTokenClass.set_pin方法的具体用法?Python EmailTokenClass.set_pin怎么用?Python EmailTokenClass.set_pin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.tokens.emailtoken.EmailTokenClass
的用法示例。
在下文中一共展示了EmailTokenClass.set_pin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_17_challenge_token
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import set_pin [as 别名]
def test_17_challenge_token(self):
db_token = Token.query.filter_by(serial=self.serial1).first()
token = EmailTokenClass(db_token)
token.set_pin(self.otppin)
r = token.is_challenge_request(self.otppin)
self.assertTrue(r)
示例2: test_06_set_pin
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import set_pin [as 别名]
def test_06_set_pin(self):
db_token = Token.query.filter_by(serial=self.serial1).first()
token = EmailTokenClass(db_token)
token.set_pin("hallo")
(ph1, pseed) = token.get_pin_hash_seed()
# check the database
token.set_pin("blubber")
ph2 = token.token.pin_hash
self.assertTrue(ph1 != ph2)
token.set_pin_hash_seed(ph1, pseed)
示例3: test_15_check_pin
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import set_pin [as 别名]
def test_15_check_pin(self):
db_token = Token.query.filter_by(serial=self.serial1).first()
token = EmailTokenClass(db_token)
# test the encrypted pin
token.set_pin("encrypted", encrypt=True)
self.assertTrue(token.check_pin("encrypted"))
self.assertFalse(token.check_pin("wrong pin"))
# test the hashed pin
token.set_pin("test")
self.assertTrue(token.check_pin("test"))
self.assertFalse(token.check_pin("wrong pin"))