本文整理匯總了Python中ziggurat_foundations.models.services.user.UserService.check_password方法的典型用法代碼示例。如果您正苦於以下問題:Python UserService.check_password方法的具體用法?Python UserService.check_password怎麽用?Python UserService.check_password使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ziggurat_foundations.models.services.user.UserService
的用法示例。
在下文中一共展示了UserService.check_password方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_password
# 需要導入模塊: from ziggurat_foundations.models.services.user import UserService [as 別名]
# 或者: from ziggurat_foundations.models.services.user.UserService import check_password [as 別名]
def check_password(self, raw_password):
"""
.. deprecated:: 0.8
:param raw_password:
:return:
"""
return UserService.check_password(self, raw_password=raw_password)
示例2: sign_in
# 需要導入模塊: from ziggurat_foundations.models.services.user import UserService [as 別名]
# 或者: from ziggurat_foundations.models.services.user.UserService import check_password [as 別名]
def sign_in(self, request):
came_from = request.params.get(self.signin_came_from_key, "/")
db_session = self.session_getter(request)
user = UserService.by_user_name(
request.params.get(self.signin_username_key), db_session=db_session
)
if user is None:
# if no result, test to see if email exists
user = UserService.by_email(
request.params.get(self.signin_username_key), db_session=db_session
)
if user:
password = request.params.get(self.signin_password_key)
if UserService.check_password(user, password):
headers = pyramid.security.remember(request, user.id)
return ZigguratSignInSuccess(
headers=headers, came_from=came_from, user=user
)
headers = pyramid.security.forget(request)
return ZigguratSignInBadAuth(headers=headers, came_from=came_from)