mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
Use smart_str instead of .encode on passwords
We originally tried to prune these .encode() calls out of the tree in favor of smart_str but we must have missed this one. This allows migration 0066 to work if utf-8 characters are used in the password
This commit is contained in:
parent
d4dccff20c
commit
ee8a76f32b
@ -147,7 +147,7 @@ def encrypt_field(instance, field_name, ask=False):
|
||||
value = getattr(instance, field_name)
|
||||
if not value or value.startswith('$encrypted$') or (ask and value == 'ASK'):
|
||||
return value
|
||||
value = value.encode('utf-8')
|
||||
value = smart_str(value)
|
||||
key = get_encryption_key(instance, field_name)
|
||||
cipher = AES.new(key, AES.MODE_ECB)
|
||||
while len(value) % cipher.block_size != 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user