This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/pages/crypto/CertificateGenerateForm.ts
Jens Langhammer bffa51f7df web: cleanup required attr
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-03-29 18:25:59 +02:00

47 lines
1.8 KiB
TypeScript

import { CertificateGeneration, CryptoApi } from "authentik-api";
import { CertificateKeyPair } from "authentik-api/src";
import { gettext } from "django";
import { customElement } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../api/Config";
import { Form } from "../../elements/forms/Form";
import "../../elements/forms/HorizontalFormElement";
@customElement("ak-crypto-certificate-generate-form")
export class CertificateKeyPairForm extends Form<CertificateGeneration> {
getSuccessMessage(): string {
return gettext("Successfully generated certificate-key pair.");
}
send = (data: CertificateGeneration): Promise<CertificateKeyPair> => {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsGenerate({
data: data
});
};
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Common Name")}
name="commonName"
?required=${true}>
<input type="text" class="pf-c-form-control" required>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Subject-alt name")}
name="subjectAltName">
<input class="pf-c-form-control" type="text">
<p class="pf-c-form__helper-text">${gettext("Optional, comma-separated SubjectAlt Names.")}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Validity days")}
name="validityDays"
?required=${true}>
<input class="pf-c-form-control" type="number" value="365">
</ak-form-element-horizontal>
</form>`;
}
}