diff --git a/web/src/user/user-settings/mfa/MFADeviceForm.ts b/web/src/user/user-settings/mfa/MFADeviceForm.ts index 1a7f4ec76..e7f7195eb 100644 --- a/web/src/user/user-settings/mfa/MFADeviceForm.ts +++ b/web/src/user/user-settings/mfa/MFADeviceForm.ts @@ -1,7 +1,7 @@ import { t } from "@lingui/macro"; import { TemplateResult, html } from "lit"; -import { customElement } from "lit/decorators"; +import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { AuthenticatorsApi, Device } from "@goauthentik/api"; @@ -12,9 +12,14 @@ import { ModelForm } from "../../../elements/forms/ModelForm"; @customElement("ak-user-mfa-form") export class MFADeviceForm extends ModelForm { + @property() + deviceType!: string; + loadInstance(pk: number): Promise { return new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsAllList().then((devices) => { - return devices.filter((device) => device.pk === pk)[0]; + return devices.filter((device) => { + return device.pk === pk && device.type === this.deviceType; + })[0]; }); } diff --git a/web/src/user/user-settings/mfa/MFADevicesPage.ts b/web/src/user/user-settings/mfa/MFADevicesPage.ts index caaa83139..ca848c8c1 100644 --- a/web/src/user/user-settings/mfa/MFADevicesPage.ts +++ b/web/src/user/user-settings/mfa/MFADevicesPage.ts @@ -146,7 +146,8 @@ export class MFADevicesPage extends Table { ${t`Update`} ${t`Update Device`} - + +