web/admin: always override send method instead of assigning (#5426)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-04-30 19:55:29 +03:00 committed by GitHub
parent bb8b87fcb3
commit fef841a458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
66 changed files with 137 additions and 138 deletions

View File

@ -34,14 +34,14 @@ export class ApplicationCheckAccessForm extends Form<{ forUser: number }> {
return t`Successfully sent test-request.`; return t`Successfully sent test-request.`;
} }
send = async (data: { forUser: number }): Promise<PolicyTestResult> => { async send(data: { forUser: number }): Promise<PolicyTestResult> {
this.request = data.forUser; this.request = data.forUser;
const result = await new CoreApi(DEFAULT_CONFIG).coreApplicationsCheckAccessRetrieve({ const result = await new CoreApi(DEFAULT_CONFIG).coreApplicationsCheckAccessRetrieve({
slug: this.application?.slug, slug: this.application?.slug,
forUser: data.forUser, forUser: data.forUser,
}); });
return (this.result = result); return (this.result = result);
}; }
resetForm(): void { resetForm(): void {
super.resetForm(); super.resetForm();

View File

@ -49,7 +49,7 @@ export class ApplicationForm extends ModelForm<Application, string> {
} }
} }
send = async (data: Application): Promise<Application | void> => { async send(data: Application): Promise<Application | void> {
let app: Application; let app: Application;
if (this.instance) { if (this.instance) {
app = await new CoreApi(DEFAULT_CONFIG).coreApplicationsUpdate({ app = await new CoreApi(DEFAULT_CONFIG).coreApplicationsUpdate({
@ -80,7 +80,7 @@ export class ApplicationForm extends ModelForm<Application, string> {
}); });
} }
return app; return app;
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -63,7 +63,7 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
); );
} }
send = (data: BlueprintInstance): Promise<BlueprintInstance> => { async send(data: BlueprintInstance): Promise<BlueprintInstance> {
if (this.instance?.pk) { if (this.instance?.pk) {
return new ManagedApi(DEFAULT_CONFIG).managedBlueprintsUpdate({ return new ManagedApi(DEFAULT_CONFIG).managedBlueprintsUpdate({
instanceUuid: this.instance.pk, instanceUuid: this.instance.pk,
@ -74,7 +74,7 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
blueprintInstanceRequest: data, blueprintInstanceRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -15,11 +15,11 @@ export class CertificateKeyPairForm extends Form<CertificateGenerationRequest> {
return t`Successfully generated certificate-key pair.`; return t`Successfully generated certificate-key pair.`;
} }
send = (data: CertificateGenerationRequest): Promise<CertificateKeyPair> => { async send(data: CertificateGenerationRequest): Promise<CertificateKeyPair> {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsGenerateCreate({ return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsGenerateCreate({
certificateGenerationRequest: data, certificateGenerationRequest: data,
}); });
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -27,7 +27,7 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
} }
} }
send = (data: CertificateKeyPair): Promise<CertificateKeyPair> => { async send(data: CertificateKeyPair): Promise<CertificateKeyPair> {
if (this.instance) { if (this.instance) {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsPartialUpdate({ return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsPartialUpdate({
kpUuid: this.instance.pk || "", kpUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
certificateKeyPairRequest: data as unknown as CertificateKeyPairRequest, certificateKeyPairRequest: data as unknown as CertificateKeyPairRequest,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -44,7 +44,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
} }
} }
send = (data: NotificationRule): Promise<NotificationRule> => { async send(data: NotificationRule): Promise<NotificationRule> {
if (this.instance) { if (this.instance) {
return new EventsApi(DEFAULT_CONFIG).eventsRulesUpdate({ return new EventsApi(DEFAULT_CONFIG).eventsRulesUpdate({
pbmUuid: this.instance.pk || "", pbmUuid: this.instance.pk || "",
@ -55,7 +55,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
notificationRuleRequest: data, notificationRuleRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -44,7 +44,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
} }
} }
send = (data: NotificationTransport): Promise<NotificationTransport> => { async send(data: NotificationTransport): Promise<NotificationTransport> {
if (this.instance) { if (this.instance) {
return new EventsApi(DEFAULT_CONFIG).eventsTransportsUpdate({ return new EventsApi(DEFAULT_CONFIG).eventsTransportsUpdate({
uuid: this.instance.pk || "", uuid: this.instance.pk || "",
@ -55,7 +55,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
notificationTransportRequest: data, notificationTransportRequest: data,
}); });
} }
}; }
onModeChange(mode: string | undefined): void { onModeChange(mode: string | undefined): void {
if ( if (

View File

@ -45,7 +45,7 @@ export class FlowForm extends ModelForm<Flow, string> {
@property({ type: Boolean }) @property({ type: Boolean })
clearBackground = false; clearBackground = false;
send = async (data: Flow): Promise<void | Flow> => { async send(data: Flow): Promise<void | Flow> {
let flow: Flow; let flow: Flow;
if (this.instance) { if (this.instance) {
flow = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesUpdate({ flow = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesUpdate({
@ -76,7 +76,7 @@ export class FlowForm extends ModelForm<Flow, string> {
}); });
} }
return flow; return flow;
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -26,7 +26,7 @@ export class FlowImportForm extends Form<Flow> {
return super.styles.concat(PFDescriptionList); return super.styles.concat(PFDescriptionList);
} }
send = async (): Promise<FlowImportResult> => { async send(): Promise<FlowImportResult> {
const file = this.getFormFiles()["flow"]; const file = this.getFormFiles()["flow"];
if (!file) { if (!file) {
throw new SentryIgnoredError("No form data"); throw new SentryIgnoredError("No form data");
@ -39,7 +39,7 @@ export class FlowImportForm extends Form<Flow> {
throw new SentryIgnoredError("Failed to import flow"); throw new SentryIgnoredError("Failed to import flow");
} }
return result; return result;
}; }
renderResult(): TemplateResult { renderResult(): TemplateResult {
return html` return html`

View File

@ -44,7 +44,7 @@ export class GroupForm extends ModelForm<Group, string> {
} }
} }
send = (data: Group): Promise<Group> => { async send(data: Group): Promise<Group> {
if (this.instance?.pk) { if (this.instance?.pk) {
return new CoreApi(DEFAULT_CONFIG).coreGroupsPartialUpdate({ return new CoreApi(DEFAULT_CONFIG).coreGroupsPartialUpdate({
groupUuid: this.instance.pk, groupUuid: this.instance.pk,
@ -56,7 +56,7 @@ export class GroupForm extends ModelForm<Group, string> {
groupRequest: data, groupRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -86,7 +86,7 @@ export class OutpostForm extends ModelForm<Outpost, string> {
} }
} }
send = (data: Outpost): Promise<Outpost> => { async send(data: Outpost): Promise<Outpost> {
if (this.instance) { if (this.instance) {
return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({ return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({
uuid: this.instance.pk || "", uuid: this.instance.pk || "",
@ -97,7 +97,7 @@ export class OutpostForm extends ModelForm<Outpost, string> {
outpostRequest: data, outpostRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -34,7 +34,7 @@ export class ServiceConnectionDockerForm extends ModelForm<DockerServiceConnecti
} }
} }
send = (data: DockerServiceConnection): Promise<DockerServiceConnection> => { async send(data: DockerServiceConnection): Promise<DockerServiceConnection> {
if (this.instance) { if (this.instance) {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerUpdate({ return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerUpdate({
uuid: this.instance.pk || "", uuid: this.instance.pk || "",
@ -45,7 +45,7 @@ export class ServiceConnectionDockerForm extends ModelForm<DockerServiceConnecti
dockerServiceConnectionRequest: data, dockerServiceConnectionRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -32,7 +32,7 @@ export class ServiceConnectionKubernetesForm extends ModelForm<
} }
} }
send = (data: KubernetesServiceConnection): Promise<KubernetesServiceConnection> => { async send(data: KubernetesServiceConnection): Promise<KubernetesServiceConnection> {
if (this.instance) { if (this.instance) {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsKubernetesUpdate({ return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsKubernetesUpdate({
uuid: this.instance.pk || "", uuid: this.instance.pk || "",
@ -43,7 +43,7 @@ export class ServiceConnectionKubernetesForm extends ModelForm<
kubernetesServiceConnectionRequest: data, kubernetesServiceConnectionRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -39,14 +39,14 @@ export class PolicyTestForm extends Form<PolicyTestRequest> {
return t`Successfully sent test-request.`; return t`Successfully sent test-request.`;
} }
send = async (data: PolicyTestRequest): Promise<PolicyTestResult> => { async send(data: PolicyTestRequest): Promise<PolicyTestResult> {
this.request = data; this.request = data;
const result = await new PoliciesApi(DEFAULT_CONFIG).policiesAllTestCreate({ const result = await new PoliciesApi(DEFAULT_CONFIG).policiesAllTestCreate({
policyUuid: this.policy?.pk || "", policyUuid: this.policy?.pk || "",
policyTestRequest: data, policyTestRequest: data,
}); });
return (this.result = result); return (this.result = result);
}; }
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return super.styles.concat(PFDescriptionList); return super.styles.concat(PFDescriptionList);

View File

@ -28,7 +28,7 @@ export class DummyPolicyForm extends ModelForm<DummyPolicy, string> {
} }
} }
send = (data: DummyPolicy): Promise<DummyPolicy> => { async send(data: DummyPolicy): Promise<DummyPolicy> {
if (this.instance) { if (this.instance) {
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({
policyUuid: this.instance.pk || "", policyUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class DummyPolicyForm extends ModelForm<DummyPolicy, string> {
dummyPolicyRequest: data, dummyPolicyRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -42,7 +42,7 @@ export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string
} }
} }
send = (data: EventMatcherPolicy): Promise<EventMatcherPolicy> => { async send(data: EventMatcherPolicy): Promise<EventMatcherPolicy> {
if (this.instance) { if (this.instance) {
return new PoliciesApi(DEFAULT_CONFIG).policiesEventMatcherUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesEventMatcherUpdate({
policyUuid: this.instance.pk || "", policyUuid: this.instance.pk || "",
@ -53,7 +53,7 @@ export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string
eventMatcherPolicyRequest: data, eventMatcherPolicyRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -28,7 +28,7 @@ export class PasswordExpiryPolicyForm extends ModelForm<PasswordExpiryPolicy, st
} }
} }
send = (data: PasswordExpiryPolicy): Promise<PasswordExpiryPolicy> => { async send(data: PasswordExpiryPolicy): Promise<PasswordExpiryPolicy> {
if (this.instance) { if (this.instance) {
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryUpdate({
policyUuid: this.instance.pk || "", policyUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PasswordExpiryPolicyForm extends ModelForm<PasswordExpiryPolicy, st
passwordExpiryPolicyRequest: data, passwordExpiryPolicyRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -30,7 +30,7 @@ export class ExpressionPolicyForm extends ModelForm<ExpressionPolicy, string> {
} }
} }
send = (data: ExpressionPolicy): Promise<ExpressionPolicy> => { async send(data: ExpressionPolicy): Promise<ExpressionPolicy> {
if (this.instance) { if (this.instance) {
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionUpdate({
policyUuid: this.instance.pk || "", policyUuid: this.instance.pk || "",
@ -41,7 +41,7 @@ export class ExpressionPolicyForm extends ModelForm<ExpressionPolicy, string> {
expressionPolicyRequest: data, expressionPolicyRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -44,7 +44,7 @@ export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
} }
} }
send = (data: PasswordPolicy): Promise<PasswordPolicy> => { async send(data: PasswordPolicy): Promise<PasswordPolicy> {
if (this.instance) { if (this.instance) {
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordUpdate({
policyUuid: this.instance.pk || "", policyUuid: this.instance.pk || "",
@ -55,7 +55,7 @@ export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
passwordPolicyRequest: data, passwordPolicyRequest: data,
}); });
} }
}; }
renderStaticRules(): TemplateResult { renderStaticRules(): TemplateResult {
return html` <ak-form-group> return html` <ak-form-group>

View File

@ -28,7 +28,7 @@ export class ReputationPolicyForm extends ModelForm<ReputationPolicy, string> {
} }
} }
send = (data: ReputationPolicy): Promise<ReputationPolicy> => { async send(data: ReputationPolicy): Promise<ReputationPolicy> {
if (this.instance) { if (this.instance) {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUpdate({
policyUuid: this.instance.pk || "", policyUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class ReputationPolicyForm extends ModelForm<ReputationPolicy, string> {
reputationPolicyRequest: data, reputationPolicyRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -28,7 +28,7 @@ export class PropertyMappingLDAPForm extends ModelForm<LDAPPropertyMapping, stri
} }
} }
send = (data: LDAPPropertyMapping): Promise<LDAPPropertyMapping> => { async send(data: LDAPPropertyMapping): Promise<LDAPPropertyMapping> {
if (this.instance) { if (this.instance) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({ return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({
pmUuid: this.instance.pk || "", pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingLDAPForm extends ModelForm<LDAPPropertyMapping, stri
lDAPPropertyMappingRequest: data, lDAPPropertyMappingRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -28,7 +28,7 @@ export class PropertyMappingNotification extends ModelForm<NotificationWebhookMa
} }
} }
send = (data: NotificationWebhookMapping): Promise<NotificationWebhookMapping> => { async send(data: NotificationWebhookMapping): Promise<NotificationWebhookMapping> {
if (this.instance) { if (this.instance) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationUpdate({ return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationUpdate({
pmUuid: this.instance.pk || "", pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingNotification extends ModelForm<NotificationWebhookMa
notificationWebhookMappingRequest: data, notificationWebhookMappingRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -28,7 +28,7 @@ export class PropertyMappingSAMLForm extends ModelForm<SAMLPropertyMapping, stri
} }
} }
send = (data: SAMLPropertyMapping): Promise<SAMLPropertyMapping> => { async send(data: SAMLPropertyMapping): Promise<SAMLPropertyMapping> {
if (this.instance) { if (this.instance) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({ return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({
pmUuid: this.instance.pk || "", pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingSAMLForm extends ModelForm<SAMLPropertyMapping, stri
sAMLPropertyMappingRequest: data, sAMLPropertyMappingRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -28,7 +28,7 @@ export class PropertyMappingSCIMForm extends ModelForm<SCIMMapping, string> {
} }
} }
send = (data: SCIMMapping): Promise<SCIMMapping> => { async send(data: SCIMMapping): Promise<SCIMMapping> {
if (this.instance) { if (this.instance) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimUpdate({ return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimUpdate({
pmUuid: this.instance.pk || "", pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingSCIMForm extends ModelForm<SCIMMapping, string> {
sCIMMappingRequest: data, sCIMMappingRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -28,7 +28,7 @@ export class PropertyMappingScopeForm extends ModelForm<ScopeMapping, string> {
} }
} }
send = (data: ScopeMapping): Promise<ScopeMapping> => { async send(data: ScopeMapping): Promise<ScopeMapping> {
if (this.instance) { if (this.instance) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeUpdate({ return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeUpdate({
pmUuid: this.instance.pk || "", pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingScopeForm extends ModelForm<ScopeMapping, string> {
scopeMappingRequest: data, scopeMappingRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -37,7 +37,7 @@ export class PolicyTestForm extends Form<PolicyTestRequest> {
return t`Successfully sent test-request.`; return t`Successfully sent test-request.`;
} }
send = async (data: PolicyTestRequest): Promise<PropertyMappingTestResult> => { async send(data: PolicyTestRequest): Promise<PropertyMappingTestResult> {
this.request = data; this.request = data;
const result = await new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllTestCreate({ const result = await new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllTestCreate({
pmUuid: this.mapping?.pk || "", pmUuid: this.mapping?.pk || "",
@ -45,7 +45,7 @@ export class PolicyTestForm extends Form<PolicyTestRequest> {
formatResult: true, formatResult: true,
}); });
return (this.result = result); return (this.result = result);
}; }
renderResult(): TemplateResult { renderResult(): TemplateResult {
return html`<ak-form-element-horizontal label=${t`Result`}> return html`<ak-form-element-horizontal label=${t`Result`}>

View File

@ -46,7 +46,7 @@ export class LDAPProviderFormPage extends ModelForm<LDAPProvider, number> {
} }
} }
send = (data: LDAPProvider): Promise<LDAPProvider> => { async send(data: LDAPProvider): Promise<LDAPProvider> {
if (this.instance) { if (this.instance) {
return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({ return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({
id: this.instance.pk || 0, id: this.instance.pk || 0,
@ -58,7 +58,7 @@ export class LDAPProviderFormPage extends ModelForm<LDAPProvider, number> {
lDAPProviderRequest: data, lDAPProviderRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -69,7 +69,7 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
} }
} }
send = (data: OAuth2Provider): Promise<OAuth2Provider> => { async send(data: OAuth2Provider): Promise<OAuth2Provider> {
if (this.instance) { if (this.instance) {
return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({ return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({
id: this.instance.pk || 0, id: this.instance.pk || 0,
@ -80,7 +80,7 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
oAuth2ProviderRequest: data, oAuth2ProviderRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -90,7 +90,7 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
} }
} }
send = (data: ProxyProvider): Promise<ProxyProvider> => { async send(data: ProxyProvider): Promise<ProxyProvider> {
data.mode = this.mode; data.mode = this.mode;
if (this.mode !== ProxyMode.ForwardDomain) { if (this.mode !== ProxyMode.ForwardDomain) {
data.cookieDomain = ""; data.cookieDomain = "";
@ -105,7 +105,7 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
proxyProviderRequest: data, proxyProviderRequest: data,
}); });
} }
}; }
renderHttpBasic(): TemplateResult { renderHttpBasic(): TemplateResult {
return html`<ak-form-element-horizontal return html`<ak-form-element-horizontal

View File

@ -38,7 +38,7 @@ export class RadiusProviderFormPage extends ModelForm<RadiusProvider, number> {
} }
} }
send = (data: RadiusProvider): Promise<RadiusProvider> => { async send(data: RadiusProvider): Promise<RadiusProvider> {
if (this.instance) { if (this.instance) {
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusUpdate({ return new ProvidersApi(DEFAULT_CONFIG).providersRadiusUpdate({
id: this.instance.pk || 0, id: this.instance.pk || 0,
@ -49,7 +49,7 @@ export class RadiusProviderFormPage extends ModelForm<RadiusProvider, number> {
radiusProviderRequest: data, radiusProviderRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -58,7 +58,7 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
} }
} }
send = (data: SAMLProvider): Promise<SAMLProvider> => { async send(data: SAMLProvider): Promise<SAMLProvider> {
if (this.instance) { if (this.instance) {
return new ProvidersApi(DEFAULT_CONFIG).providersSamlUpdate({ return new ProvidersApi(DEFAULT_CONFIG).providersSamlUpdate({
id: this.instance.pk || 0, id: this.instance.pk || 0,
@ -69,7 +69,7 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
sAMLProviderRequest: data, sAMLProviderRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -25,7 +25,7 @@ export class SAMLProviderImportForm extends Form<SAMLProvider> {
return t`Successfully imported provider.`; return t`Successfully imported provider.`;
} }
send = (data: SAMLProvider): Promise<void> => { async send(data: SAMLProvider): Promise<void> {
const file = this.getFormFiles()["metadata"]; const file = this.getFormFiles()["metadata"];
if (!file) { if (!file) {
throw new SentryIgnoredError("No form data"); throw new SentryIgnoredError("No form data");
@ -35,7 +35,7 @@ export class SAMLProviderImportForm extends Form<SAMLProvider> {
name: data.name, name: data.name,
authorizationFlow: data.authorizationFlow || "", authorizationFlow: data.authorizationFlow || "",
}); });
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -48,7 +48,7 @@ export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
} }
} }
send = (data: SCIMProvider): Promise<SCIMProvider> => { async send(data: SCIMProvider): Promise<SCIMProvider> {
if (this.instance) { if (this.instance) {
return new ProvidersApi(DEFAULT_CONFIG).providersScimUpdate({ return new ProvidersApi(DEFAULT_CONFIG).providersScimUpdate({
id: this.instance.pk || 0, id: this.instance.pk || 0,
@ -59,7 +59,7 @@ export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
sCIMProviderRequest: data, sCIMProviderRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -51,7 +51,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
} }
} }
send = (data: LDAPSource): Promise<LDAPSource> => { async send(data: LDAPSource): Promise<LDAPSource> {
if (this.instance) { if (this.instance) {
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({ return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({
slug: this.instance.slug, slug: this.instance.slug,
@ -62,7 +62,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
lDAPSourceRequest: data as unknown as LDAPSourceRequest, lDAPSourceRequest: data as unknown as LDAPSourceRequest,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -71,7 +71,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
} }
} }
send = async (data: OAuthSource): Promise<OAuthSource> => { async send(data: OAuthSource): Promise<OAuthSource> {
data.providerType = (this.providerType?.slug || "") as ProviderTypeEnum; data.providerType = (this.providerType?.slug || "") as ProviderTypeEnum;
let source: OAuthSource; let source: OAuthSource;
if (this.instance) { if (this.instance) {
@ -103,7 +103,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
}); });
} }
return source; return source;
}; }
renderUrlOptions(): TemplateResult { renderUrlOptions(): TemplateResult {
if (!this.providerType?.urlsCustomizable) { if (!this.providerType?.urlsCustomizable) {

View File

@ -61,7 +61,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
} }
} }
send = async (data: PlexSource): Promise<PlexSource> => { async send(data: PlexSource): Promise<PlexSource> {
data.plexToken = this.plexToken || ""; data.plexToken = this.plexToken || "";
let source: PlexSource; let source: PlexSource;
if (this.instance?.pk) { if (this.instance?.pk) {
@ -93,7 +93,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
}); });
} }
return source; return source;
}; }
async doAuth(): Promise<void> { async doAuth(): Promise<void> {
const authInfo = await PlexAPIClient.getPin(this.instance?.clientId || ""); const authInfo = await PlexAPIClient.getPin(this.instance?.clientId || "");

View File

@ -54,7 +54,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
} }
} }
send = async (data: SAMLSource): Promise<SAMLSource> => { async send(data: SAMLSource): Promise<SAMLSource> {
let source: SAMLSource; let source: SAMLSource;
if (this.instance) { if (this.instance) {
source = await new SourcesApi(DEFAULT_CONFIG).sourcesSamlUpdate({ source = await new SourcesApi(DEFAULT_CONFIG).sourcesSamlUpdate({
@ -85,7 +85,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
}); });
} }
return source; return source;
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -37,7 +37,7 @@ export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage,
} }
} }
send = (data: AuthenticatorDuoStage): Promise<AuthenticatorDuoStage> => { async send(data: AuthenticatorDuoStage): Promise<AuthenticatorDuoStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoPartialUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoPartialUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -48,7 +48,7 @@ export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage,
authenticatorDuoStageRequest: data as unknown as AuthenticatorDuoStageRequest, authenticatorDuoStageRequest: data as unknown as AuthenticatorDuoStageRequest,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -34,13 +34,13 @@ export class DuoDeviceImportForm extends ModelForm<AuthenticatorDuoStage, string
return t`Successfully imported device.`; return t`Successfully imported device.`;
} }
send = (data: AuthenticatorDuoStage): Promise<void> => { async send(data: AuthenticatorDuoStage): Promise<void> {
const importData = data as unknown as AuthenticatorDuoStageManualDeviceImportRequest; const importData = data as unknown as AuthenticatorDuoStageManualDeviceImportRequest;
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoImportDeviceManualCreate({ return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoImportDeviceManualCreate({
stageUuid: this.instance?.pk || "", stageUuid: this.instance?.pk || "",
authenticatorDuoStageManualDeviceImportRequest: importData, authenticatorDuoStageManualDeviceImportRequest: importData,
}); });
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html` <form class="pf-c-form pf-m-horizontal"> return html` <form class="pf-c-form pf-m-horizontal">

View File

@ -54,7 +54,7 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
} }
} }
send = (data: AuthenticatorSMSStage): Promise<AuthenticatorSMSStage> => { async send(data: AuthenticatorSMSStage): Promise<AuthenticatorSMSStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorSmsUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorSmsUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -65,7 +65,7 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
authenticatorSMSStageRequest: data, authenticatorSMSStageRequest: data,
}); });
} }
}; }
renderProviderTwillio(): TemplateResult { renderProviderTwillio(): TemplateResult {
return html` <ak-form-element-horizontal return html` <ak-form-element-horizontal

View File

@ -35,7 +35,7 @@ export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticS
} }
} }
send = (data: AuthenticatorStaticStage): Promise<AuthenticatorStaticStage> => { async send(data: AuthenticatorStaticStage): Promise<AuthenticatorStaticStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -46,7 +46,7 @@ export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticS
authenticatorStaticStageRequest: data, authenticatorStaticStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -37,7 +37,7 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage
} }
} }
send = (data: AuthenticatorTOTPStage): Promise<AuthenticatorTOTPStage> => { async send(data: AuthenticatorTOTPStage): Promise<AuthenticatorTOTPStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -48,7 +48,7 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage
authenticatorTOTPStageRequest: data, authenticatorTOTPStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -50,7 +50,7 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
} }
} }
send = (data: AuthenticatorValidateStage): Promise<AuthenticatorValidateStage> => { async send(data: AuthenticatorValidateStage): Promise<AuthenticatorValidateStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -61,7 +61,7 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
authenticatorValidateStageRequest: data, authenticatorValidateStageRequest: data,
}); });
} }
}; }
isDeviceClassSelected(field: DeviceClassesEnum): boolean { isDeviceClassSelected(field: DeviceClassesEnum): boolean {
return ( return (

View File

@ -39,7 +39,7 @@ export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuth
} }
} }
send = (data: AuthenticateWebAuthnStage): Promise<AuthenticateWebAuthnStage> => { async send(data: AuthenticateWebAuthnStage): Promise<AuthenticateWebAuthnStage> {
if (data.authenticatorAttachment?.toString() === "") { if (data.authenticatorAttachment?.toString() === "") {
data.authenticatorAttachment = null; data.authenticatorAttachment = null;
} }
@ -53,7 +53,7 @@ export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuth
authenticateWebAuthnStageRequest: data, authenticateWebAuthnStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -27,7 +27,7 @@ export class CaptchaStageForm extends ModelForm<CaptchaStage, string> {
} }
} }
send = (data: CaptchaStage): Promise<CaptchaStage> => { async send(data: CaptchaStage): Promise<CaptchaStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaPartialUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesCaptchaPartialUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class CaptchaStageForm extends ModelForm<CaptchaStage, string> {
captchaStageRequest: data as unknown as CaptchaStageRequest, captchaStageRequest: data as unknown as CaptchaStageRequest,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -36,7 +36,7 @@ export class ConsentStageForm extends ModelForm<ConsentStage, string> {
} }
} }
send = (data: ConsentStage): Promise<ConsentStage> => { async send(data: ConsentStage): Promise<ConsentStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesConsentUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesConsentUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -47,7 +47,7 @@ export class ConsentStageForm extends ModelForm<ConsentStage, string> {
consentStageRequest: data, consentStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -26,7 +26,7 @@ export class DenyStageForm extends ModelForm<DenyStage, string> {
} }
} }
send = (data: DenyStage): Promise<DenyStage> => { async send(data: DenyStage): Promise<DenyStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesDenyUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesDenyUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -37,7 +37,7 @@ export class DenyStageForm extends ModelForm<DenyStage, string> {
denyStageRequest: data, denyStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -27,7 +27,7 @@ export class DummyStageForm extends ModelForm<DummyStage, string> {
} }
} }
send = (data: DummyStage): Promise<DummyStage> => { async send(data: DummyStage): Promise<DummyStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesDummyUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesDummyUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class DummyStageForm extends ModelForm<DummyStage, string> {
dummyStageRequest: data, dummyStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -39,7 +39,7 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
} }
} }
send = (data: EmailStage): Promise<EmailStage> => { async send(data: EmailStage): Promise<EmailStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesEmailPartialUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesEmailPartialUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -50,7 +50,7 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
emailStageRequest: data, emailStageRequest: data,
}); });
} }
}; }
renderConnectionSettings(): TemplateResult { renderConnectionSettings(): TemplateResult {
if (!this.showConnectionSettings) { if (!this.showConnectionSettings) {

View File

@ -50,7 +50,7 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
} }
} }
send = (data: IdentificationStage): Promise<IdentificationStage> => { async send(data: IdentificationStage): Promise<IdentificationStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesIdentificationUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -61,7 +61,7 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
identificationStageRequest: data, identificationStageRequest: data,
}); });
} }
}; }
isUserFieldSelected(field: UserFieldsEnum): boolean { isUserFieldSelected(field: UserFieldsEnum): boolean {
return ( return (

View File

@ -37,7 +37,7 @@ export class InvitationForm extends ModelForm<Invitation, string> {
} }
} }
send = (data: Invitation): Promise<Invitation> => { async send(data: Invitation): Promise<Invitation> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsUpdate({
inviteUuid: this.instance.pk || "", inviteUuid: this.instance.pk || "",
@ -48,7 +48,7 @@ export class InvitationForm extends ModelForm<Invitation, string> {
invitationRequest: data, invitationRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -27,7 +27,7 @@ export class InvitationStageForm extends ModelForm<InvitationStage, string> {
} }
} }
send = (data: InvitationStage): Promise<InvitationStage> => { async send(data: InvitationStage): Promise<InvitationStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class InvitationStageForm extends ModelForm<InvitationStage, string> {
invitationStageRequest: data, invitationStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -38,7 +38,7 @@ export class PasswordStageForm extends ModelForm<PasswordStage, string> {
} }
} }
send = (data: PasswordStage): Promise<PasswordStage> => { async send(data: PasswordStage): Promise<PasswordStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesPasswordUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesPasswordUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -49,7 +49,7 @@ export class PasswordStageForm extends ModelForm<PasswordStage, string> {
passwordStageRequest: data, passwordStageRequest: data,
}); });
} }
}; }
isBackendSelected(field: BackendsEnum): boolean { isBackendSelected(field: BackendsEnum): boolean {
if (!this.instance) { if (!this.instance) {

View File

@ -47,7 +47,7 @@ export class PromptStageForm extends ModelForm<PromptStage, string> {
} }
} }
send = (data: PromptStage): Promise<PromptStage> => { async send(data: PromptStage): Promise<PromptStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -58,7 +58,7 @@ export class PromptStageForm extends ModelForm<PromptStage, string> {
promptStageRequest: data, promptStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -26,7 +26,7 @@ export class UserDeleteStageForm extends ModelForm<UserDeleteStage, string> {
} }
} }
send = (data: UserDeleteStage): Promise<UserDeleteStage> => { async send(data: UserDeleteStage): Promise<UserDeleteStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -37,7 +37,7 @@ export class UserDeleteStageForm extends ModelForm<UserDeleteStage, string> {
userDeleteStageRequest: data, userDeleteStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -29,7 +29,7 @@ export class UserLoginStageForm extends ModelForm<UserLoginStage, string> {
} }
} }
send = (data: UserLoginStage): Promise<UserLoginStage> => { async send(data: UserLoginStage): Promise<UserLoginStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesUserLoginUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -40,7 +40,7 @@ export class UserLoginStageForm extends ModelForm<UserLoginStage, string> {
userLoginStageRequest: data, userLoginStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -26,7 +26,7 @@ export class UserLogoutStageForm extends ModelForm<UserLogoutStage, string> {
} }
} }
send = (data: UserLogoutStage): Promise<UserLogoutStage> => { async send(data: UserLogoutStage): Promise<UserLogoutStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -37,7 +37,7 @@ export class UserLogoutStageForm extends ModelForm<UserLogoutStage, string> {
userLogoutStageRequest: data, userLogoutStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -31,7 +31,7 @@ export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
} }
} }
send = (data: UserWriteStage): Promise<UserWriteStage> => { async send(data: UserWriteStage): Promise<UserWriteStage> {
if (this.instance) { if (this.instance) {
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteUpdate({ return new StagesApi(DEFAULT_CONFIG).stagesUserWriteUpdate({
stageUuid: this.instance.pk || "", stageUuid: this.instance.pk || "",
@ -42,7 +42,7 @@ export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
userWriteStageRequest: data, userWriteStageRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -42,7 +42,7 @@ export class TenantForm extends ModelForm<Tenant, string> {
} }
} }
send = (data: Tenant): Promise<Tenant> => { async send(data: Tenant): Promise<Tenant> {
if (this.instance?.tenantUuid) { if (this.instance?.tenantUuid) {
return new CoreApi(DEFAULT_CONFIG).coreTenantsUpdate({ return new CoreApi(DEFAULT_CONFIG).coreTenantsUpdate({
tenantUuid: this.instance.tenantUuid, tenantUuid: this.instance.tenantUuid,
@ -53,7 +53,7 @@ export class TenantForm extends ModelForm<Tenant, string> {
tenantRequest: data, tenantRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -29,7 +29,7 @@ export class TokenForm extends ModelForm<Token, string> {
} }
} }
send = (data: Token): Promise<Token> => { async send(data: Token): Promise<Token> {
if (this.instance?.identifier) { if (this.instance?.identifier) {
return new CoreApi(DEFAULT_CONFIG).coreTokensUpdate({ return new CoreApi(DEFAULT_CONFIG).coreTokensUpdate({
identifier: this.instance.identifier, identifier: this.instance.identifier,
@ -40,7 +40,7 @@ export class TokenForm extends ModelForm<Token, string> {
tokenRequest: data, tokenRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -21,14 +21,14 @@ export class ServiceAccountForm extends Form<UserServiceAccountRequest> {
return t`Successfully created user.`; return t`Successfully created user.`;
} }
send = async (data: UserServiceAccountRequest): Promise<UserServiceAccountResponse> => { async send(data: UserServiceAccountRequest): Promise<UserServiceAccountResponse> {
const result = await new CoreApi(DEFAULT_CONFIG).coreUsersServiceAccountCreate({ const result = await new CoreApi(DEFAULT_CONFIG).coreUsersServiceAccountCreate({
userServiceAccountRequest: data, userServiceAccountRequest: data,
}); });
this.result = result; this.result = result;
(this.parentElement as ModalForm).showSubmitButton = false; (this.parentElement as ModalForm).showSubmitButton = false;
return result; return result;
}; }
resetForm(): void { resetForm(): void {
super.resetForm(); super.resetForm();

View File

@ -41,7 +41,7 @@ export class UserForm extends ModelForm<User, number> {
} }
} }
send = (data: User): Promise<User> => { async send(data: User): Promise<User> {
if (this.instance?.pk) { if (this.instance?.pk) {
return new CoreApi(DEFAULT_CONFIG).coreUsersPartialUpdate({ return new CoreApi(DEFAULT_CONFIG).coreUsersPartialUpdate({
id: this.instance.pk, id: this.instance.pk,
@ -53,7 +53,7 @@ export class UserForm extends ModelForm<User, number> {
userRequest: data, userRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -19,12 +19,12 @@ export class UserPasswordForm extends Form<UserPasswordSetRequest> {
return t`Successfully updated password.`; return t`Successfully updated password.`;
} }
send = (data: UserPasswordSetRequest): Promise<void> => { async send(data: UserPasswordSetRequest): Promise<void> {
return new CoreApi(DEFAULT_CONFIG).coreUsersSetPasswordCreate({ return new CoreApi(DEFAULT_CONFIG).coreUsersSetPasswordCreate({
id: this.instancePk || 0, id: this.instancePk || 0,
userPasswordSetRequest: data, userPasswordSetRequest: data,
}); });
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -27,10 +27,10 @@ export class UserResetEmailForm extends Form<CoreUsersRecoveryEmailRetrieveReque
return t`Successfully sent email.`; return t`Successfully sent email.`;
} }
send = (data: CoreUsersRecoveryEmailRetrieveRequest): Promise<void> => { async send(data: CoreUsersRecoveryEmailRetrieveRequest): Promise<void> {
data.id = this.user.pk; data.id = this.user.pk;
return new CoreApi(DEFAULT_CONFIG).coreUsersRecoveryEmailRetrieve(data); return new CoreApi(DEFAULT_CONFIG).coreUsersRecoveryEmailRetrieve(data);
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -15,19 +15,18 @@ export class MFADeviceForm extends ModelForm<Device, number> {
@property() @property()
deviceType!: string; deviceType!: string;
loadInstance(pk: number): Promise<Device> { async loadInstance(pk: number): Promise<Device> {
return new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsAllList().then((devices) => { const devices = await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsAllList();
return devices.filter((device) => { return devices.filter((device) => {
return device.pk === pk && device.type === this.deviceType; return device.pk === pk && device.type === this.deviceType;
})[0]; })[0];
});
} }
getSuccessMessage(): string { getSuccessMessage(): string {
return t`Successfully updated device.`; return t`Successfully updated device.`;
} }
send = async (device: Device): Promise<Device> => { async send(device: Device): Promise<Device> {
switch (this.instance?.type) { switch (this.instance?.type) {
case "authentik_stages_authenticator_duo.DuoDevice": case "authentik_stages_authenticator_duo.DuoDevice":
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsDuoUpdate({ await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsDuoUpdate({
@ -63,7 +62,7 @@ export class MFADeviceForm extends ModelForm<Device, number> {
break; break;
} }
return device; return device;
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">

View File

@ -29,7 +29,7 @@ export class UserTokenForm extends ModelForm<Token, string> {
} }
} }
send = (data: Token): Promise<Token> => { async send(data: Token): Promise<Token> {
if (this.instance) { if (this.instance) {
return new CoreApi(DEFAULT_CONFIG).coreTokensUpdate({ return new CoreApi(DEFAULT_CONFIG).coreTokensUpdate({
identifier: this.instance.identifier, identifier: this.instance.identifier,
@ -41,7 +41,7 @@ export class UserTokenForm extends ModelForm<Token, string> {
tokenRequest: data, tokenRequest: data,
}); });
} }
}; }
renderForm(): TemplateResult { renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal"> return html`<form class="pf-c-form pf-m-horizontal">