Pull requests

#17 Merged
Repository
buddelkiste buddelkiste
Branch
default
Repository
ubernostrum ubernostrum
Branch
default

Use hashlib instead of deprecated django.utils.hashcompat

Author
  1. Tobias Berling
Reviewers
Description

Using django.utils.hashcompat is deprecated and shows a PendingDeprecationWarning. Use hashlib instead.

  • Learn about pull requests

Comments (2)

  1. Ryan Allen

    Need to encode the as UTF-8 for Python 3

        def create_profile(self, user):
            random_str = str(random.random()).encode('utf-8')
            salt = hashlib.sha1(random_str).hexdigest()[:5]
            salted = (salt + user.username).encode('utf-8')
            activation_key = hashlib.sha1(salted).hexdigest()
            return self.create(user=user, activation_key=activation_key)