From 7be032bdc9ccb9e4edf267931e99209225769b59 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 23 Feb 2024 19:18:44 +0100 Subject: [PATCH] fix encoding passwords --- idhub_auth/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idhub_auth/models.py b/idhub_auth/models.py index c75c7e3..f50e59e 100644 --- a/idhub_auth/models.py +++ b/idhub_auth/models.py @@ -145,13 +145,13 @@ class User(AbstractBaseUser): self.encrypted_sensitive_data = key_crypted def encrypt_data(self, data): - pw = self.decrypt_sensitive_data() + pw = self.decrypt_sensitive_data().encode('utf-8') sb = self.get_secret_box(pw) value_enc = sb.encrypt(data.encode('utf-8')) return base64.b64encode(value_enc).decode('utf-8') def decrypt_data(self, data): - pw = self.decrypt_sensitive_data() + pw = self.decrypt_sensitive_data().encode('utf-8') sb = self.get_secret_box(pw) value = base64.b64decode(data.encode('utf-8')) return sb.decrypt(value).decode('utf-8')