Commit 2a8c358d authored by fred's avatar fred

always pass bytes to hashlib

parent 98b133a2
......@@ -18,6 +18,7 @@ from django.template import loader
from django.template.loader import render_to_string
from django.conf import settings
from django.utils.encoding import force_bytes
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
......@@ -42,7 +43,7 @@ class Subscriber(models.Model) :
self.send_confirmation_email()
def send_confirmation_email(self):
self.password = hashlib.sha1(str(random.random())).hexdigest()
self.password = hashlib.sha1(force_bytes(str(random.random()))).hexdigest()
confirm_subject = loader.get_template('newsletter/confirmation_email_subject.txt')
confirm_body = loader.get_template('newsletter/confirmation_email_body.txt')
context = {'token': self.password}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment