hide private key on edit cert page; preserve key if new one is not provided

This commit is contained in:
Nancy Butler 2020-05-14 10:48:06 -07:00
parent 654073a7bf
commit be110d79af
1 changed files with 9 additions and 2 deletions

View File

@ -62,7 +62,7 @@ export default {
}
if (this.value._type === TLS) {
key = base64Decode((this.value.data || {})['tls.key']);
key = this.mode === 'edit' ? '' : base64Decode((this.value.data || {})['tls.key']);
crt = base64Decode((this.value.data || {})['tls.crt']);
}
@ -138,7 +138,14 @@ export default {
this.$set(this.value, 'data', data);
} else if (this.isCertificate) {
const data = { 'tls.crt': base64Encode(this.crt), 'tls.key': base64Encode(this.key) };
let keyToSave;
if (this.mode === 'edit' && !this.key.length) {
keyToSave = (this.value.data || {})['tls.key'];
} else {
keyToSave = base64Encode(this.key);
}
const data = { 'tls.crt': base64Encode(this.crt), 'tls.key': keyToSave };
this.$set(this.value, 'data', data);
}