Skip to content

Commit

Permalink
Pull request 2016: 6217-warning-validation
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 50c3b54
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Sep 15 16:49:42 2023 +0300

    client: fix warning validation
  • Loading branch information
schzhn committed Sep 15, 2023
1 parent a59fca2 commit 5c20bf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/src/components/Settings/Encryption/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const validate = (values) => {
return errors;
};

const clearFields = (change, setTlsConfig, t) => {
const clearFields = (change, setTlsConfig, validateTlsConfig, t) => {
const fields = {
private_key: '',
certificate_chain: '',
Expand All @@ -53,6 +53,7 @@ const clearFields = (change, setTlsConfig, t) => {
Object.keys(fields)
.forEach((field) => change(field, fields[field]));
setTlsConfig(fields);
validateTlsConfig(fields);
}
};

Expand Down Expand Up @@ -102,6 +103,7 @@ let Form = (props) => {
subject,
warning_validation,
setTlsConfig,
validateTlsConfig,
certificateSource,
privateKeySource,
privateKeySaved,
Expand Down Expand Up @@ -419,7 +421,7 @@ let Form = (props) => {
type="button"
className="btn btn-secondary btn-standart"
disabled={submitting || processingConfig}
onClick={() => clearFields(change, setTlsConfig, t)}
onClick={() => clearFields(change, setTlsConfig, validateTlsConfig, t)}
>
<Trans>reset_settings</Trans>
</button>
Expand Down Expand Up @@ -455,6 +457,7 @@ Form.propTypes = {
subject: PropTypes.string,
t: PropTypes.func.isRequired,
setTlsConfig: PropTypes.func.isRequired,
validateTlsConfig: PropTypes.func.isRequired,
certificateSource: PropTypes.string,
privateKeySource: PropTypes.string,
privateKeySaved: PropTypes.bool,
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Settings/Encryption/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class Encryption extends Component {
onSubmit={this.handleFormSubmit}
onChange={this.handleFormChange}
setTlsConfig={this.props.setTlsConfig}
validateTlsConfig={this.props.validateTlsConfig}
{...this.props.encryption}
/>
</Card>
Expand Down

0 comments on commit 5c20bf7

Please sign in to comment.