本文整理汇总了Python中pdoauth.models.Assurance.Assurance.listByUser方法的典型用法代码示例。如果您正苦于以下问题:Python Assurance.listByUser方法的具体用法?Python Assurance.listByUser怎么用?Python Assurance.listByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdoauth.models.Assurance.Assurance
的用法示例。
在下文中一共展示了Assurance.listByUser方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateHashAndAssurances
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def updateHashAndAssurances(self, user, digest):
user.hash = digest
assurances = Assurance.listByUser(user)
self.deleteHandAssuredAssurances(assurances)
if digest is not None:
Assurance.new(user, "hashgiven", user)
user.save()
示例2: computeAssurancesForApp
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def computeAssurancesForApp(self, user, app):
appAssurances = AppAssurance.get(app)
userAssurances = Assurance.listByUser(user)
shownAssurances = list()
for userAssurance in userAssurances:
if userAssurance.name in appAssurances:
shownAssurances.append(userAssurance.name)
return shownAssurances
示例3: do_update_hash
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def do_update_hash(self,form):
digest = form.digest.data
if digest == '':
digest = None
user = self.getCurrentUser()
user.hash = digest
user.save()
assurances = Assurance.listByUser(user)
self.deleteHandAssuredAssurances(assurances)
return self.simple_response('new hash registered')
示例4: updateEmailByCredential
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def updateEmailByCredential(self, cred, verify):
oldemail=cred.user.email
cred.user.email = cred.getAdditionalInfo()
cred.user.save()
for assurance in Assurance.listByUser(cred.user, 'emailverification'):
assurance.rm()
if verify:
Assurance.new(cred.user, 'emailverification', cred.user)
else:
self.sendPasswordVerificationEmail(cred.user)
self.sendEmail(cred.user, None, None, "CHANGE_EMAIL_DONE",oldemail=oldemail, newemail=cred.user.email)
示例5: do_deregister
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def do_deregister(self,form):
if not self.isLoginCredentials(form):
raise ReportedError(["You should use your login credentials to deregister"], 400)
cred = Credential.get(form.credentialType.data, form.identifier.data)
user = cred.user
creds = Credential.getByUser(user)
for cred in creds:
cred.rm()
assurances = Assurance.listByUser(user)
for assurance in assurances:
assurance.rm()
user.rm()
return self.simple_response('deregistered')
示例6: test_adding_assurance_is_possible_using_the_hash_only
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def test_adding_assurance_is_possible_using_the_hash_only(self):
form = self.prepareLoginForm(email = False)
self.controller.doAddAssurance(form)
self.assertEqual(Assurance.listByUser(self.targetUser)[0].name, 'test')
示例7: test_assurers_with_appropriate_credential_can_add_assurance_to_user_using_hash
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def test_assurers_with_appropriate_credential_can_add_assurance_to_user_using_hash(self):
form = self.prepareLoginForm()
self.controller.doAddAssurance(form)
self.assertEqual(Assurance.listByUser(self.targetUser)[0].name, 'test')
示例8: test_confirmChangeEmail_deletes_emailverification_assurance
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def test_confirmChangeEmail_deletes_emailverification_assurance(self):
self.doConfirmChangeEmail()
self.assertEqual(list(),Assurance.listByUser(self.user,'emailverification'))
示例9: removeAssurances
# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import listByUser [as 别名]
def removeAssurances(self, user):
assurances = Assurance.listByUser(user)
for assurance in assurances:
assurance.rm()