Commits

Anonymous committed d47d8f4

Encode unicode strings to UTF-8 before passing to sha_constructor.

Comments (0)

Files changed (1)

registration/models.py

         
         """
         salt = sha_constructor(str(random.random())).hexdigest()[:5]
-        activation_key = sha_constructor(salt+user.username).hexdigest()
+        username = user.username
+        if isinstance(username, unicode):
+            username = username.encode('utf-8')
+        activation_key = sha_constructor(salt+username).hexdigest()
         return self.create(user=user,
                            activation_key=activation_key)