From b8595b87c4c8705eddc8eed711b4760da9e894fa Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Thu, 28 Feb 2019 14:59:25 +0300 Subject: [PATCH] * disable config saving if invalid pair --- .../components/Settings/Encryption/Form.js | 21 +++++++++++-------- client/src/reducers/encryption.js | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/client/src/components/Settings/Encryption/Form.js b/client/src/components/Settings/Encryption/Form.js index f4b01560..fd43f933 100644 --- a/client/src/components/Settings/Encryption/Form.js +++ b/client/src/components/Settings/Encryption/Form.js @@ -57,6 +57,7 @@ let Form = (props) => { valid_chain, valid_key, valid_cert, + valid_pair, dns_names, key_type, issuer, @@ -65,6 +66,15 @@ let Form = (props) => { setTlsConfig, } = props; + const isSavingDisabled = invalid + || submitting + || processingConfig + || processingValidate + || (isEnabled && (!privateKey || !certificateChain)) + || (privateKey && !valid_key) + || (certificateChain && !valid_cert) + || (privateKey && certificateChain && !valid_pair); + return (
@@ -291,15 +301,7 @@ let Form = (props) => { @@ -334,6 +336,7 @@ Form.propTypes = { valid_chain: PropTypes.bool, valid_key: PropTypes.bool, valid_cert: PropTypes.bool, + valid_pair: PropTypes.bool, dns_names: PropTypes.string, key_type: PropTypes.string, issuer: PropTypes.string, diff --git a/client/src/reducers/encryption.js b/client/src/reducers/encryption.js index 3f51b217..f861701b 100644 --- a/client/src/reducers/encryption.js +++ b/client/src/reducers/encryption.js @@ -70,6 +70,7 @@ const encryption = handleActions({ valid_chain: false, valid_key: false, valid_cert: false, + valid_pair: false, status_cert: '', status_key: '', certificate_chain: '',