示例#1
0
 def generate_token(self):
     max_tries, tries = 5, 0
     while tries <= max_tries:
         human_hasher = HumanHasher()
         human_token, token = human_hasher.uuid()
         try:
             Voucher.objects.get(human_token=human_token)
             tries += 1
         except Voucher.DoesNotExist:
             break
     return token, human_token
示例#2
0
 def is_valid_token(self, token):
     human_hasher = HumanHasher()
     return human_hasher.humanize(token) == self.human_token
示例#3
0
 def generate_token(self):
     human_hasher = HumanHasher()
     return human_hasher.uuid()