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.`;
}
send = async (data: { forUser: number }): Promise<PolicyTestResult> => {
async send(data: { forUser: number }): Promise<PolicyTestResult> {
this.request = data.forUser;
const result = await new CoreApi(DEFAULT_CONFIG).coreApplicationsCheckAccessRetrieve({
slug: this.application?.slug,
forUser: data.forUser,
});
return (this.result = result);
};
}
resetForm(): void {
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;
if (this.instance) {
app = await new CoreApi(DEFAULT_CONFIG).coreApplicationsUpdate({
@ -80,7 +80,7 @@ export class ApplicationForm extends ModelForm<Application, string> {
});
}
return app;
};
}
renderForm(): TemplateResult {
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) {
return new ManagedApi(DEFAULT_CONFIG).managedBlueprintsUpdate({
instanceUuid: this.instance.pk,
@ -74,7 +74,7 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
blueprintInstanceRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = (data: CertificateGenerationRequest): Promise<CertificateKeyPair> => {
async send(data: CertificateGenerationRequest): Promise<CertificateKeyPair> {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsGenerateCreate({
certificateGenerationRequest: data,
});
};
}
renderForm(): TemplateResult {
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) {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsPartialUpdate({
kpUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
certificateKeyPairRequest: data as unknown as CertificateKeyPairRequest,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new EventsApi(DEFAULT_CONFIG).eventsRulesUpdate({
pbmUuid: this.instance.pk || "",
@ -55,7 +55,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
notificationRuleRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new EventsApi(DEFAULT_CONFIG).eventsTransportsUpdate({
uuid: this.instance.pk || "",
@ -55,7 +55,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
notificationTransportRequest: data,
});
}
};
}
onModeChange(mode: string | undefined): void {
if (

View File

@ -45,7 +45,7 @@ export class FlowForm extends ModelForm<Flow, string> {
@property({ type: Boolean })
clearBackground = false;
send = async (data: Flow): Promise<void | Flow> => {
async send(data: Flow): Promise<void | Flow> {
let flow: Flow;
if (this.instance) {
flow = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesUpdate({
@ -76,7 +76,7 @@ export class FlowForm extends ModelForm<Flow, string> {
});
}
return flow;
};
}
renderForm(): TemplateResult {
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);
}
send = async (): Promise<FlowImportResult> => {
async send(): Promise<FlowImportResult> {
const file = this.getFormFiles()["flow"];
if (!file) {
throw new SentryIgnoredError("No form data");
@ -39,7 +39,7 @@ export class FlowImportForm extends Form<Flow> {
throw new SentryIgnoredError("Failed to import flow");
}
return result;
};
}
renderResult(): TemplateResult {
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) {
return new CoreApi(DEFAULT_CONFIG).coreGroupsPartialUpdate({
groupUuid: this.instance.pk,
@ -56,7 +56,7 @@ export class GroupForm extends ModelForm<Group, string> {
groupRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({
uuid: this.instance.pk || "",
@ -97,7 +97,7 @@ export class OutpostForm extends ModelForm<Outpost, string> {
outpostRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerUpdate({
uuid: this.instance.pk || "",
@ -45,7 +45,7 @@ export class ServiceConnectionDockerForm extends ModelForm<DockerServiceConnecti
dockerServiceConnectionRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsKubernetesUpdate({
uuid: this.instance.pk || "",
@ -43,7 +43,7 @@ export class ServiceConnectionKubernetesForm extends ModelForm<
kubernetesServiceConnectionRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = async (data: PolicyTestRequest): Promise<PolicyTestResult> => {
async send(data: PolicyTestRequest): Promise<PolicyTestResult> {
this.request = data;
const result = await new PoliciesApi(DEFAULT_CONFIG).policiesAllTestCreate({
policyUuid: this.policy?.pk || "",
policyTestRequest: data,
});
return (this.result = result);
};
}
static get styles(): CSSResult[] {
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) {
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({
policyUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class DummyPolicyForm extends ModelForm<DummyPolicy, string> {
dummyPolicyRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PoliciesApi(DEFAULT_CONFIG).policiesEventMatcherUpdate({
policyUuid: this.instance.pk || "",
@ -53,7 +53,7 @@ export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string
eventMatcherPolicyRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryUpdate({
policyUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PasswordExpiryPolicyForm extends ModelForm<PasswordExpiryPolicy, st
passwordExpiryPolicyRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionUpdate({
policyUuid: this.instance.pk || "",
@ -41,7 +41,7 @@ export class ExpressionPolicyForm extends ModelForm<ExpressionPolicy, string> {
expressionPolicyRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordUpdate({
policyUuid: this.instance.pk || "",
@ -55,7 +55,7 @@ export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
passwordPolicyRequest: data,
});
}
};
}
renderStaticRules(): TemplateResult {
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) {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUpdate({
policyUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class ReputationPolicyForm extends ModelForm<ReputationPolicy, string> {
reputationPolicyRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({
pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingLDAPForm extends ModelForm<LDAPPropertyMapping, stri
lDAPPropertyMappingRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationUpdate({
pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingNotification extends ModelForm<NotificationWebhookMa
notificationWebhookMappingRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({
pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingSAMLForm extends ModelForm<SAMLPropertyMapping, stri
sAMLPropertyMappingRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimUpdate({
pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingSCIMForm extends ModelForm<SCIMMapping, string> {
sCIMMappingRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeUpdate({
pmUuid: this.instance.pk || "",
@ -39,7 +39,7 @@ export class PropertyMappingScopeForm extends ModelForm<ScopeMapping, string> {
scopeMappingRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = async (data: PolicyTestRequest): Promise<PropertyMappingTestResult> => {
async send(data: PolicyTestRequest): Promise<PropertyMappingTestResult> {
this.request = data;
const result = await new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllTestCreate({
pmUuid: this.mapping?.pk || "",
@ -45,7 +45,7 @@ export class PolicyTestForm extends Form<PolicyTestRequest> {
formatResult: true,
});
return (this.result = result);
};
}
renderResult(): TemplateResult {
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) {
return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({
id: this.instance.pk || 0,
@ -58,7 +58,7 @@ export class LDAPProviderFormPage extends ModelForm<LDAPProvider, number> {
lDAPProviderRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({
id: this.instance.pk || 0,
@ -80,7 +80,7 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
oAuth2ProviderRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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;
if (this.mode !== ProxyMode.ForwardDomain) {
data.cookieDomain = "";
@ -105,7 +105,7 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
proxyProviderRequest: data,
});
}
};
}
renderHttpBasic(): TemplateResult {
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) {
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusUpdate({
id: this.instance.pk || 0,
@ -49,7 +49,7 @@ export class RadiusProviderFormPage extends ModelForm<RadiusProvider, number> {
radiusProviderRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new ProvidersApi(DEFAULT_CONFIG).providersSamlUpdate({
id: this.instance.pk || 0,
@ -69,7 +69,7 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
sAMLProviderRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = (data: SAMLProvider): Promise<void> => {
async send(data: SAMLProvider): Promise<void> {
const file = this.getFormFiles()["metadata"];
if (!file) {
throw new SentryIgnoredError("No form data");
@ -35,7 +35,7 @@ export class SAMLProviderImportForm extends Form<SAMLProvider> {
name: data.name,
authorizationFlow: data.authorizationFlow || "",
});
};
}
renderForm(): TemplateResult {
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) {
return new ProvidersApi(DEFAULT_CONFIG).providersScimUpdate({
id: this.instance.pk || 0,
@ -59,7 +59,7 @@ export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
sCIMProviderRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({
slug: this.instance.slug,
@ -62,7 +62,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
lDAPSourceRequest: data as unknown as LDAPSourceRequest,
});
}
};
}
renderForm(): TemplateResult {
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;
let source: OAuthSource;
if (this.instance) {
@ -103,7 +103,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
});
}
return source;
};
}
renderUrlOptions(): TemplateResult {
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 || "";
let source: PlexSource;
if (this.instance?.pk) {
@ -93,7 +93,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
});
}
return source;
};
}
async doAuth(): Promise<void> {
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;
if (this.instance) {
source = await new SourcesApi(DEFAULT_CONFIG).sourcesSamlUpdate({
@ -85,7 +85,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
});
}
return source;
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoPartialUpdate({
stageUuid: this.instance.pk || "",
@ -48,7 +48,7 @@ export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage,
authenticatorDuoStageRequest: data as unknown as AuthenticatorDuoStageRequest,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = (data: AuthenticatorDuoStage): Promise<void> => {
async send(data: AuthenticatorDuoStage): Promise<void> {
const importData = data as unknown as AuthenticatorDuoStageManualDeviceImportRequest;
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoImportDeviceManualCreate({
stageUuid: this.instance?.pk || "",
authenticatorDuoStageManualDeviceImportRequest: importData,
});
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorSmsUpdate({
stageUuid: this.instance.pk || "",
@ -65,7 +65,7 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
authenticatorSMSStageRequest: data,
});
}
};
}
renderProviderTwillio(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticUpdate({
stageUuid: this.instance.pk || "",
@ -46,7 +46,7 @@ export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticS
authenticatorStaticStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpUpdate({
stageUuid: this.instance.pk || "",
@ -48,7 +48,7 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage
authenticatorTOTPStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateUpdate({
stageUuid: this.instance.pk || "",
@ -61,7 +61,7 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
authenticatorValidateStageRequest: data,
});
}
};
}
isDeviceClassSelected(field: DeviceClassesEnum): boolean {
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() === "") {
data.authenticatorAttachment = null;
}
@ -53,7 +53,7 @@ export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuth
authenticateWebAuthnStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaPartialUpdate({
stageUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class CaptchaStageForm extends ModelForm<CaptchaStage, string> {
captchaStageRequest: data as unknown as CaptchaStageRequest,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesConsentUpdate({
stageUuid: this.instance.pk || "",
@ -47,7 +47,7 @@ export class ConsentStageForm extends ModelForm<ConsentStage, string> {
consentStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesDenyUpdate({
stageUuid: this.instance.pk || "",
@ -37,7 +37,7 @@ export class DenyStageForm extends ModelForm<DenyStage, string> {
denyStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesDummyUpdate({
stageUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class DummyStageForm extends ModelForm<DummyStage, string> {
dummyStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesEmailPartialUpdate({
stageUuid: this.instance.pk || "",
@ -50,7 +50,7 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
emailStageRequest: data,
});
}
};
}
renderConnectionSettings(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationUpdate({
stageUuid: this.instance.pk || "",
@ -61,7 +61,7 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
identificationStageRequest: data,
});
}
};
}
isUserFieldSelected(field: UserFieldsEnum): boolean {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsUpdate({
inviteUuid: this.instance.pk || "",
@ -48,7 +48,7 @@ export class InvitationForm extends ModelForm<Invitation, string> {
invitationRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesUpdate({
stageUuid: this.instance.pk || "",
@ -38,7 +38,7 @@ export class InvitationStageForm extends ModelForm<InvitationStage, string> {
invitationStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesPasswordUpdate({
stageUuid: this.instance.pk || "",
@ -49,7 +49,7 @@ export class PasswordStageForm extends ModelForm<PasswordStage, string> {
passwordStageRequest: data,
});
}
};
}
isBackendSelected(field: BackendsEnum): boolean {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesUpdate({
stageUuid: this.instance.pk || "",
@ -58,7 +58,7 @@ export class PromptStageForm extends ModelForm<PromptStage, string> {
promptStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteUpdate({
stageUuid: this.instance.pk || "",
@ -37,7 +37,7 @@ export class UserDeleteStageForm extends ModelForm<UserDeleteStage, string> {
userDeleteStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginUpdate({
stageUuid: this.instance.pk || "",
@ -40,7 +40,7 @@ export class UserLoginStageForm extends ModelForm<UserLoginStage, string> {
userLoginStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutUpdate({
stageUuid: this.instance.pk || "",
@ -37,7 +37,7 @@ export class UserLogoutStageForm extends ModelForm<UserLogoutStage, string> {
userLogoutStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteUpdate({
stageUuid: this.instance.pk || "",
@ -42,7 +42,7 @@ export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
userWriteStageRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new CoreApi(DEFAULT_CONFIG).coreTenantsUpdate({
tenantUuid: this.instance.tenantUuid,
@ -53,7 +53,7 @@ export class TenantForm extends ModelForm<Tenant, string> {
tenantRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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) {
return new CoreApi(DEFAULT_CONFIG).coreTokensUpdate({
identifier: this.instance.identifier,
@ -40,7 +40,7 @@ export class TokenForm extends ModelForm<Token, string> {
tokenRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = async (data: UserServiceAccountRequest): Promise<UserServiceAccountResponse> => {
async send(data: UserServiceAccountRequest): Promise<UserServiceAccountResponse> {
const result = await new CoreApi(DEFAULT_CONFIG).coreUsersServiceAccountCreate({
userServiceAccountRequest: data,
});
this.result = result;
(this.parentElement as ModalForm).showSubmitButton = false;
return result;
};
}
resetForm(): void {
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) {
return new CoreApi(DEFAULT_CONFIG).coreUsersPartialUpdate({
id: this.instance.pk,
@ -53,7 +53,7 @@ export class UserForm extends ModelForm<User, number> {
userRequest: data,
});
}
};
}
renderForm(): TemplateResult {
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.`;
}
send = (data: UserPasswordSetRequest): Promise<void> => {
async send(data: UserPasswordSetRequest): Promise<void> {
return new CoreApi(DEFAULT_CONFIG).coreUsersSetPasswordCreate({
id: this.instancePk || 0,
userPasswordSetRequest: data,
});
};
}
renderForm(): TemplateResult {
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.`;
}
send = (data: CoreUsersRecoveryEmailRetrieveRequest): Promise<void> => {
async send(data: CoreUsersRecoveryEmailRetrieveRequest): Promise<void> {
data.id = this.user.pk;
return new CoreApi(DEFAULT_CONFIG).coreUsersRecoveryEmailRetrieve(data);
};
}
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">

View File

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