本文整理汇总了Python中apex.models.AuthUser.check_password方法的典型用法代码示例。如果您正苦于以下问题:Python AuthUser.check_password方法的具体用法?Python AuthUser.check_password怎么用?Python AuthUser.check_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apex.models.AuthUser
的用法示例。
在下文中一共展示了AuthUser.check_password方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login_validator
# 需要导入模块: from apex.models import AuthUser [as 别名]
# 或者: from apex.models.AuthUser import check_password [as 别名]
def login_validator(node, kw):
"""Validate a username and password."""
valid = False
if "username" in kw:
valid = AuthUser.check_password(login=kw["username"], password=kw["password"])
if not valid:
raise Invalid(node, "Your username or password is incorrect.")
示例2: login_validator
# 需要导入模块: from apex.models import AuthUser [as 别名]
# 或者: from apex.models.AuthUser import check_password [as 别名]
def login_validator(node, kw):
"""Validate a username and password."""
valid = False
if 'username' in kw:
kwargs = {
'login': kw['username'],
'password': kw['password'],
}
valid = AuthUser.check_password(**kwargs)
# XXX: extend apex to get user by login or email
if not valid:
user = AuthUser.get_by_email(kw['username'])
if user:
del kwargs['login']
kwargs['id'] = user.id
valid = AuthUser.check_password(**kwargs)
if not valid:
raise Invalid(
node,
"Your username or password is incorrect."
)
示例3: clean
# 需要导入模块: from apex.models import AuthUser [as 别名]
# 或者: from apex.models.AuthUser import check_password [as 别名]
def clean(self):
errors = []
if not AuthUser.check_password(login=self.data.get('login'), \
password=self.data.get('password')):
errors.append(_('Login Error -- please try again'))
return errors
示例4: validate_old_password
# 需要导入模块: from apex.models import AuthUser [as 别名]
# 或者: from apex.models.AuthUser import check_password [as 别名]
def validate_old_password(form, field):
request = get_current_request()
if not AuthUser.check_password(id=authenticated_userid(request), \
password=field.data):
raise validators.ValidationError(_('Your old password doesn\'t match'))
示例5: clean
# 需要导入模块: from apex.models import AuthUser [as 别名]
# 或者: from apex.models.AuthUser import check_password [as 别名]
def clean(self):
errors = []
if not AuthUser.check_password(username=self.data.get("username"), password=self.data.get("password")):
errors.append(_("Login Error -- please try again"))
return errors