From e8d20c6b3657f1822b6e0fe9c656909bd7d91d23 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 3 Dec 2020 11:53:13 +0100 Subject: [PATCH] misc: decode bytes in User.set_random_password() (#49072) --- src/authentic2/custom_user/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/authentic2/custom_user/models.py b/src/authentic2/custom_user/models.py index 225d13f1..a02fa85e 100644 --- a/src/authentic2/custom_user/models.py +++ b/src/authentic2/custom_user/models.py @@ -371,7 +371,7 @@ class User(AbstractBaseUser, PermissionMixin): self.save(update_fields=['is_active', 'deleted']) def set_random_password(self): - self.set_password(base64.b64encode(os.urandom(32))) + self.set_password(base64.b64encode(os.urandom(32)).decode('ascii')) class DeletedUser(models.Model): -- 2.29.2