diff --git a/CHANGES.rst b/CHANGES.rst index 45c1c8b..28520f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -21,6 +21,7 @@ New Features: Fixes: - fixed misc. crashes +- fixed Domain.generate_ns_secret() storing bytes object into Domain.nameserver_update_secret leading to trying to insert the string representation of the bytes object, so 91 characters in a varchar(88) Other changes: diff --git a/src/nsupdate/main/models.py b/src/nsupdate/main/models.py index 5cc69ca..9a4485d 100644 --- a/src/nsupdate/main/models.py +++ b/src/nsupdate/main/models.py @@ -141,7 +141,7 @@ class Domain(models.Model): user_model = get_user_model() secret = user_model.objects.make_random_password(length=bitlength // 8) secret = secret.encode('utf-8') - self.nameserver_update_secret = secret_base64 = base64.b64encode(secret) + self.nameserver_update_secret = secret_base64 = base64.b64encode(secret).decode('utf-8') self.save() return secret_base64