allow encrypted fields in custom credentials to be empty

This commit is contained in:
Ryan Petrello
2018-11-30 14:01:45 -05:00
parent 28733800c4
commit 7252883094
2 changed files with 23 additions and 0 deletions

View File

@@ -383,6 +383,8 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
super(Credential, self).save(*args, **kwargs)
def encrypt_field(self, field, ask):
if not hasattr(self, field):
return None
encrypted = encrypt_field(self, field, ask=ask)
if encrypted:
self.inputs[field] = encrypted