Py3 fixes for guest hash generation

This commit is contained in:
Sachi King 2017-05-07 16:17:06 +10:00
parent a36ff64a82
commit e61d87d37c

View file

@ -123,8 +123,9 @@ def proposal_speaker_manage(request, pk):
Q(user=None, invite_email=email_address)
)
except Speaker.DoesNotExist:
salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
token = hashlib.sha1(salt + email_address).hexdigest()
salt = hashlib.sha1(str(random.random()).encode('UTF-8')).hexdigest()[:5]
saltedemail = (salt + email_address).encode('UTF-8')
token = hashlib.sha1(saltedemail).hexdigest()
pending = Speaker.objects.create(
invite_email=email_address,
invite_token=token,