Only encrypt / decrypt fields with a value
This commit is contained in:
parent
0a5066ebce
commit
e2292ced40
@ -565,9 +565,10 @@ class Command(CryptMixin, BaseCommand):
|
|||||||
crypt_fields = crypt_config["fields"]
|
crypt_fields = crypt_config["fields"]
|
||||||
for manifest_record in manifest[exporter_key]:
|
for manifest_record in manifest[exporter_key]:
|
||||||
for field in crypt_fields:
|
for field in crypt_fields:
|
||||||
manifest_record["fields"][field] = self.encrypt_string(
|
if manifest_record["fields"][field]:
|
||||||
value=manifest_record["fields"][field],
|
manifest_record["fields"][field] = self.encrypt_string(
|
||||||
)
|
value=manifest_record["fields"][field],
|
||||||
|
)
|
||||||
|
|
||||||
elif (
|
elif (
|
||||||
MailAccount.objects.count() > 0
|
MailAccount.objects.count() > 0
|
||||||
|
@ -414,9 +414,10 @@ class Command(CryptMixin, BaseCommand):
|
|||||||
):
|
):
|
||||||
had_at_least_one_record = True
|
had_at_least_one_record = True
|
||||||
for field in crypt_fields:
|
for field in crypt_fields:
|
||||||
record["fields"][field] = self.decrypt_string(
|
if record["fields"][field]:
|
||||||
value=record["fields"][field],
|
record["fields"][field] = self.decrypt_string(
|
||||||
)
|
value=record["fields"][field],
|
||||||
|
)
|
||||||
|
|
||||||
if had_at_least_one_record:
|
if had_at_least_one_record:
|
||||||
# It's annoying, but the DB is loaded from the JSON directly
|
# It's annoying, but the DB is loaded from the JSON directly
|
||||||
|
Loading…
x
Reference in New Issue
Block a user