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


Python User.getByDigest方法代码示例

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


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

示例1: deleteDigestFromOtherUsers

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def deleteDigestFromOtherUsers(self, user, digest):
     if digest:
         users = User.getByDigest(digest)
         for anotherUser in users:
             if anotherUser.email != user.email:
                 anotherUser.hash = None
                 anotherUser.save()
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:9,代码来源:Controller.py

示例2: getUserForEmailAndOrHash

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def getUserForEmailAndOrHash(self, digest: Digest, email: Union[str,None]):
     if email:
         user = User.getByEmail(email)
         self.checkUserAgainsDigest(digest, user)
         return user
     users = User.getByDigest(digest)
     self.assureExactlyOneUserInList(users)
     return users[0]
开发者ID:Claymanus,项目名称:PDOauth,代码行数:10,代码来源:Controller.py

示例3: getUserForEmailAndOrHash

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def getUserForEmailAndOrHash(self, digest, email):
     if email:
         user = User.getByEmail(email)
         self.deleteDigestFromOtherUsers(user, digest)
         self.checkUserAgainsDigest(digest, user)
         return user
     users = User.getByDigest(digest)
     self.assureExactlyOneUserInList(users)
     return users[0]
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:11,代码来源:Controller.py

示例4: getUserForEmailAndOrHash

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def getUserForEmailAndOrHash(self, digest: Digest, email: Union[str,None]):
     if email:
         user = User.getByEmail(email)
         if user is None:
             raise ReportedError([noSuchUser], 400)
         self.checkUserAgainsDigest(digest, user)
         return user
     users = User.getByDigest(digest)
     self.assureExactlyOneUserInList(users)
     return users[0]
开发者ID:edemo,项目名称:PDOauth,代码行数:12,代码来源:Controller.py

示例5: checkHashInOtherUsers

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def checkHashInOtherUsers(self, user: User, additionalInfo: dict, digest: Digest) -> None:
     if digest is None:
         return
     anotherUsers = User.getByDigest(digest)
     assuredCollision = False
     if anotherUsers:
         for aUser in anotherUsers:
             if self.handAssured(aUser):
                 self.sendHashCollisionMail(aUser, assured=True, inAssurance=False)
                 assuredCollision = True
             else:
                 self.sendHashCollisionMail(aUser, assured=False, inAssurance=False)
         if assuredCollision:
             raise ReportedError([anotherUserUsingYourHash])
         additionalInfo["message"] = anotherUserUsingYourHash
开发者ID:Claymanus,项目名称:PDOauth,代码行数:17,代码来源:Controller.py

示例6: deleteDigestFromOtherUsers

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def deleteDigestFromOtherUsers(self, user: User) -> int:
     digest = user.hash
     numOfOthers = 0
     assuredCollision = False
     if digest:
         users = User.getByDigest(digest)
         for anotherUser in users:
             if anotherUser.email != user.email:
                 anotherUser.hash = None
                 anotherUser.save()
                 numOfOthers += 1
                 if self.handAssured(anotherUser):
                     self.sendHashCollisionMail(anotherUser, assured=True, inAssurance=True)
                     assuredCollision = True
     if assuredCollision:
         message = [otherUsersWithYourHash, numOfOthers]
         raise ReportedError(message)
     return numOfOthers
开发者ID:Claymanus,项目名称:PDOauth,代码行数:20,代码来源:Controller.py

示例7: _do_registration

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def _do_registration(self, form):
     additionalInfo = {}
     digest = form.digest.data
     if digest == '':
         digest = None
     if digest is not None:
         anotherUsers = User.getByDigest(form.digest.data)
         if anotherUsers:
             if self.isAnyoneHandAssurredOf(anotherUsers):
                 raise ReportedError([anotherUserUsingYourHash], 400)
             additionalInfo["message"] = anotherUserUsingYourHash
     user = CredentialManager.create_user_with_creds(
         form.credentialType.data,
         form.identifier.data,
         form.secret.data,
         form.email.data,
         digest)
     self.sendPasswordVerificationEmail(user)
     user.set_authenticated()
     user.activate()
     r = self.loginUserInFramework(user)
     if r:
         return self.returnUserAndLoginCookie(user, additionalInfo)
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:25,代码来源:Controller.py

示例8: test_getByDigest_does_not_allow_null_digest

# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByDigest [as 别名]
 def test_getByDigest_does_not_allow_null_digest(self):
     with self.assertRaises(ReportedError) as context:
         User.getByDigest(None)
     self.assertEqual(noHashGiven,context.exception.descriptor)
开发者ID:Claymanus,项目名称:PDOauth,代码行数:6,代码来源:UserTest.py


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