本文整理汇总了Python中validator.Validator.token方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.token方法的具体用法?Python Validator.token怎么用?Python Validator.token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.Validator
的用法示例。
在下文中一共展示了Validator.token方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: confirmemail
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import token [as 别名]
def confirmemail(self, email, token):
Validator.email(email)
Validator.token(token)
user = self.user.get(email)
if not user['token']:
raise RiverException('This email address has already been confirmed.')
if user['token'] != token:
raise RiverException('The token is not valid for this email address.')
self.user.update(email, enabled=True, token=False)
示例2: setpassword
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import token [as 别名]
def setpassword(self, email, token, password):
Validator.email(email)
Validator.token(token)
Validator.password(password)
user = self.user.get(email)
if not user['token']:
raise RiverException('No password change has been requested for this email address.')
if user['token'] != token:
raise RiverException('The token is not valid for this email address.')
self.user.update(email, enabled=True, token=False, password=Secret.hash(password, SALT))