Update sha_constructor to hashlib.sha256

This commit is contained in:
Volodymyr Hotsyk 2014-07-05 16:21:49 +03:00
parent 7596729ec1
commit 3ad6d4cfef

View file

@ -6,7 +6,7 @@ from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.shortcuts import render, redirect, get_object_or_404
from django.utils.hashcompat import sha_constructor
from hashlib import sha256
from django.views import static
from django.contrib import messages
@ -14,12 +14,16 @@ from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from account.models import EmailAddress
from symposion.proposals.models import ProposalBase, ProposalSection, ProposalKind
from symposion.proposals.models import (
ProposalBase, ProposalSection, ProposalKind
)
from symposion.proposals.models import SupportingDocument, AdditionalSpeaker
from symposion.speakers.models import Speaker
from symposion.utils.mail import send_email
from symposion.proposals.forms import AddSpeakerForm, SupportingDocumentCreateForm
from symposion.proposals.forms import (
AddSpeakerForm, SupportingDocumentCreateForm
)
def get_form(name):
@ -110,8 +114,8 @@ def proposal_speaker_manage(request, pk):
Q(user=None, invite_email=email_address)
)
except Speaker.DoesNotExist:
salt = sha_constructor(str(random.random())).hexdigest()[:5]
token = sha_constructor(salt + email_address).hexdigest()
salt = sha256(str(random.random())).hexdigest()[:5]
token = sha256(salt + email_address).hexdigest()
pending = Speaker.objects.create(
invite_email=email_address,
invite_token=token,