From acc8b01bef56a5fa740a7290bc0e66c7606794c9 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Tue, 2 Oct 2018 14:22:38 +0200
Subject: [PATCH] [ui][registration][model] Fix sha1 generation

---
 beat/web/ui/registration/models.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/beat/web/ui/registration/models.py b/beat/web/ui/registration/models.py
index 0a60959c1..cf883cd9b 100644
--- a/beat/web/ui/registration/models.py
+++ b/beat/web/ui/registration/models.py
@@ -258,8 +258,8 @@ class RegistrationManager(models.Manager):
         username and a random salt.
 
         """
-        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
-        activation_key = hashlib.sha1(salt+user.username).hexdigest()
+        salt = hashlib.sha1(str(random.random()).encode()).hexdigest()[:5]
+        activation_key = hashlib.sha1((salt+user.username).encode()).hexdigest()
         return self.create(user=user,
                            activation_key=activation_key)
 
-- 
GitLab