web/admin: always override send method instead of assigning (#5426)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -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) => {
|
||||
return devices.filter((device) => {
|
||||
return device.pk === pk && device.type === this.deviceType;
|
||||
})[0];
|
||||
});
|
||||
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">
|
||||
|
||||
@ -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">
|
||||
|
||||
Reference in New Issue
Block a user