Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored to use hashlib in favor of django.utils.hashcompat #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions emailconfirmation/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import datetime
import hashlib
from random import random

from django.conf import settings
from django.db import models, IntegrityError
from django.core.mail import send_mail
from django.core.urlresolvers import reverse, NoReverseMatch
from django.template.loader import render_to_string
from django.utils.hashcompat import sha_constructor
from django.utils.translation import gettext_lazy as _

from django.contrib.sites.models import Site
Expand Down Expand Up @@ -91,8 +91,8 @@ def confirm_email(self, confirmation_key):
return email_address

def send_confirmation(self, email_address):
salt = sha_constructor(str(random())).hexdigest()[:5]
confirmation_key = sha_constructor(salt + email_address.email).hexdigest()
salt = hashlib.sha1(str(random())).hexdigest()[:5]
confirmation_key = hashlib.sha1(salt + email_address.email).hexdigest()
current_site = Site.objects.get_current()
# check for the url with the dotted view path
try:
Expand Down