mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-21 03:18:23 +00:00
Change hashcompat to hashlib to depress warning
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import hashlib
|
||||
import random
|
||||
import re
|
||||
|
||||
@@ -7,7 +8,6 @@ from django.conf import settings
|
||||
from django.db import models
|
||||
from django.db import transaction
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.hashcompat import sha_constructor
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from seahub.base.accounts import User
|
||||
@@ -110,11 +110,11 @@ class RegistrationManager(models.Manager):
|
||||
username and a random salt.
|
||||
|
||||
"""
|
||||
salt = sha_constructor(str(random.random())).hexdigest()[:5]
|
||||
salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
|
||||
username = user.username
|
||||
if isinstance(username, unicode):
|
||||
username = username.encode('utf-8')
|
||||
activation_key = sha_constructor(salt+username).hexdigest()
|
||||
activation_key = hashlib.sha1(salt+username).hexdigest()
|
||||
return self.create(emailuser_id=user.id,
|
||||
activation_key=activation_key)
|
||||
|
||||
|
Reference in New Issue
Block a user