def _generate_registration_token(): """ Generate a random string, then generate a 64 character hex string using SHA-256. """ while True: token = hashlib.sha256(get_random_string(length=64)).hexdigest() if not PendingHomebuyer.objects.filter(registration_token=token): return token
def _generate_registration_token(): """ Generate a random string, then generate a 64 character hex string using SHA-256. """ while True: token = hashlib.sha256( get_random_string(length=64)).hexdigest() if not PendingHomebuyer.objects.filter(registration_token=token): return token
def gen_email_token(apps, schema_editor): User = apps.get_model('core', 'User') for row in User.objects.all(): row.email_confirmation_token = hashlib.sha256( get_random_string(length=64)).hexdigest() row.save()
def create_token(self): val = (str(timezone.now()) + self.user.email).encode('utf-8') return hashlib.sha256(val).hexdigest()
def _generate_email_confirmation_token(): while True: token = hashlib.sha256( get_random_string(length=64)).hexdigest() if not User.objects.filter(email_confirmation_token=token).exists(): return token
def _generate_email_confirmation_token(): while True: token = hashlib.sha256(get_random_string(length=64)).hexdigest() if not User.objects.filter(email_confirmation_token=token).exists(): return token