Skip to content

Commit

Permalink
+ client: handle fields for certificate path and private key path
Browse files Browse the repository at this point in the history
  • Loading branch information
IldarKamalov authored and szolin committed Aug 30, 2019
1 parent 4445c4b commit 6d63450
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 112 deletions.
12 changes: 10 additions & 2 deletions client/src/__locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,13 @@
"blocked_services_global": "Use global blocked services",
"blocked_service": "Blocked service",
"block_all": "Block all",
"unblock_all": "Unblock all"
}
"unblock_all": "Unblock all",
"encryption_certificate_path": "Certificate path",
"encryption_certificate_path_notice": "To add a path to the certificate, clear the certificate chain textarea.",
"encryption_private_key_path": "Private key path",
"encryption_private_key_path_notice": "To add a path to the private key, clear the private key textarea.",
"encryption_certificates_source_path": "Set a certificates file path",
"encryption_certificates_source_content":"Paste the certificates contents",
"encryption_key_source_path": "Set a private key file",
"encryption_key_source_content": "Paste the private key contents"
}
71 changes: 71 additions & 0 deletions client/src/components/Settings/Encryption/CertificateStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { withNamespaces, Trans } from 'react-i18next';
import format from 'date-fns/format';

import { EMPTY_DATE } from '../../../helpers/constants';

const CertificateStatus = ({
validChain,
validCert,
subject,
issuer,
notAfter,
dnsNames,
}) => (
<Fragment>
<div className="form__label form__label--bold">
<Trans>encryption_status</Trans>:
</div>
<ul className="encryption__list">
<li
className={validChain ? 'text-success' : 'text-danger'}
>
{validChain ? (
<Trans>encryption_chain_valid</Trans>
) : (
<Trans>encryption_chain_invalid</Trans>
)}
</li>
{validCert && (
<Fragment>
{subject && (
<li>
<Trans>encryption_subject</Trans>:&nbsp;
{subject}
</li>
)}
{issuer && (
<li>
<Trans>encryption_issuer</Trans>:&nbsp;
{issuer}
</li>
)}
{notAfter && notAfter !== EMPTY_DATE && (
<li>
<Trans>encryption_expire</Trans>:&nbsp;
{format(notAfter, 'YYYY-MM-DD HH:mm:ss')}
</li>
)}
{dnsNames && (
<li>
<Trans>encryption_hostnames</Trans>:&nbsp;
{dnsNames}
</li>
)}
</Fragment>
)}
</ul>
</Fragment>
);

CertificateStatus.propTypes = {
validChain: PropTypes.bool.isRequired,
validCert: PropTypes.bool.isRequired,
subject: PropTypes.string,
issuer: PropTypes.string,
notAfter: PropTypes.string,
dnsNames: PropTypes.string,
};

export default withNamespaces()(CertificateStatus);
Loading

0 comments on commit 6d63450

Please sign in to comment.