Skip to content

Commit

Permalink
Fix CertificateCreateByCname
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-slobodian committed May 30, 2024
1 parent 1664d45 commit 4d7847c
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const CertificateCreateByCname: React.FunctionComponent<
const { type = "x509", onCreateButtonClick } = props;

const { t } = useTranslation();
const [isCnameValid, setIsCnameValid] = useState(false);
const [isFormValid, setIsFormValid] = useState(false);

const algorithm: CertificateAlgorithmProps = {
hash: EHashAlgorithm.SHA_256,
Expand All @@ -51,14 +51,15 @@ export const CertificateCreateByCname: React.FunctionComponent<
};

return (
<form className={styles.form_box} onSubmit={handleSubmit}>
<form
className={styles.form_box}
onSubmit={handleSubmit}
onChange={(event) => setIsFormValid(event.currentTarget.checkValidity())}
>
<Card>
<TextField
className="required_text_field"
name="CN"
onChange={(event) =>
setIsCnameValid(event.currentTarget.checkValidity())
}
label={t("certificates.subject.cname.label")}
placeholder={t("certificates.subject.cname.placeholder")}
required
Expand All @@ -73,11 +74,8 @@ export const CertificateCreateByCname: React.FunctionComponent<
<Button
variant="contained"
color="primary"
disabled={!isCnameValid}
disabled={!isFormValid}
type="submit"
title={
!isCnameValid ? t("certificates.button-create.title") : undefined
}
>
{t(`certificates.button-create.text.${type}`)}
</Button>
Expand Down

0 comments on commit 4d7847c

Please sign in to comment.