diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 25053476..33eb0fa1 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -233,5 +233,6 @@ "topline_expiring_certificate": "Your SSL certificate is about to expire. Update <0>Encryption settings.", "form_error_port_range": "Enter port value in the range of 80-65535", "form_error_equal": "Shouldn't be equal", - "form_error_password": "Password mismatched" + "form_error_password": "Password mismatched", + "reset_settings": "Reset settings", } \ No newline at end of file diff --git a/client/src/components/Settings/Encryption/Form.js b/client/src/components/Settings/Encryption/Form.js index 4e85ea5a..db0f1b41 100644 --- a/client/src/components/Settings/Encryption/Form.js +++ b/client/src/components/Settings/Encryption/Form.js @@ -4,15 +4,17 @@ import { Field, reduxForm } from 'redux-form'; import { Trans, withNamespaces } from 'react-i18next'; import flow from 'lodash/flow'; -import { renderField, renderSelectField, required, toNumber, port } from '../../../helpers/form'; +import { renderField, renderSelectField, toNumber, port } from '../../../helpers/form'; import i18n from '../../../i18n'; const validate = (values) => { const errors = {}; - if (values.port_dns_over_tls === values.port_https) { - errors.port_dns_over_tls = i18n.t('form_error_equal'); - errors.port_https = i18n.t('form_error_equal'); + if (values.port_dns_over_tls && values.port_https) { + if (values.port_dns_over_tls === values.port_https) { + errors.port_dns_over_tls = i18n.t('form_error_equal'); + errors.port_https = i18n.t('form_error_equal'); + } } return errors; @@ -22,6 +24,7 @@ const Form = (props) => { const { t, handleSubmit, + reset, invalid, submitting, processing, @@ -46,7 +49,6 @@ const Form = (props) => { type="text" className="form-control" placeholder={t('encryption_server_enter')} - validate={[required]} />
encryption_server_desc @@ -80,7 +82,7 @@ const Form = (props) => { type="number" className="form-control" placeholder={t('encryption_https')} - validate={[required, port]} + validate={[port]} normalize={toNumber} />
@@ -100,7 +102,7 @@ const Form = (props) => { type="number" className="form-control" placeholder={t('encryption_dot')} - validate={[required, port]} + validate={[port]} normalize={toNumber} />
@@ -130,7 +132,6 @@ const Form = (props) => { type="text" className="form-control form-control--textarea" placeholder={t('encryption_certificates_input')} - validate={[required]} />
{statusCert && @@ -170,7 +171,6 @@ const Form = (props) => { type="text" className="form-control form-control--textarea" placeholder="Copy/paste your PEM-encoded private key for your cerficate here." - validate={[required]} />
{statusKey && @@ -188,19 +188,30 @@ const Form = (props) => {
- +
+ + +
); }; Form.propTypes = { handleSubmit: PropTypes.func.isRequired, + reset: PropTypes.func.isRequired, submitting: PropTypes.bool.isRequired, invalid: PropTypes.bool.isRequired, initialValues: PropTypes.object.isRequired, diff --git a/client/src/helpers/form.js b/client/src/helpers/form.js index 055d1138..39855671 100644 --- a/client/src/helpers/form.js +++ b/client/src/helpers/form.js @@ -63,7 +63,7 @@ export const isPositive = (value) => { }; export const port = (value) => { - if (value < 80 || value > 65535) { + if (value && (value < 80 || value > 65535)) { return form_error_port_range; } return false; diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index fa86b4af..3210b2c3 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -329,6 +329,11 @@ const encryption = handleActions({ processingConfig: false, status_cert: '', status_key: '', + certificate_chain: '', + private_key: '', + server_name: '', + port_https: '', + port_dns_over_tls: '', }); export default combineReducers({