fix Domain.generate_ns_secret() storing bytes object into Domain.nameserver_update_secret instead of a string

This commit is contained in:
Brice Gros 2020-01-21 14:22:37 +01:00
parent 0a625d6853
commit a8a6a208b1
2 changed files with 2 additions and 1 deletions

View File

@ -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:

View File

@ -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