web/user: update form to update mfa devices
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
f5dc81907a
commit
06766bdb25
|
@ -1288,7 +1288,6 @@ msgstr "Define how notifications are sent to users, like Email or Webhook."
|
||||||
#: src/pages/tokens/TokenListPage.ts
|
#: src/pages/tokens/TokenListPage.ts
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/tokens/UserTokenList.ts
|
#: src/user/user-settings/tokens/UserTokenList.ts
|
||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr "Delete"
|
msgstr "Delete"
|
||||||
|
@ -1396,7 +1395,6 @@ msgstr "Device classes which can be used to authenticate."
|
||||||
#~ msgstr "Device name"
|
#~ msgstr "Device name"
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Device(s)"
|
msgid "Device(s)"
|
||||||
msgstr "Device(s)"
|
msgstr "Device(s)"
|
||||||
|
|
||||||
|
@ -1617,7 +1615,6 @@ msgid "Enabling this toggle will create a group named after the user, with the u
|
||||||
msgstr "Enabling this toggle will create a group named after the user, with the user as member."
|
msgstr "Enabling this toggle will create a group named after the user, with the user as member."
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Enroll"
|
msgid "Enroll"
|
||||||
msgstr "Enroll"
|
msgstr "Enroll"
|
||||||
|
|
||||||
|
@ -2503,7 +2500,6 @@ msgstr "Load servers"
|
||||||
#: src/pages/applications/ApplicationViewPage.ts
|
#: src/pages/applications/ApplicationViewPage.ts
|
||||||
#: src/user/user-settings/details/UserDetailsForm.ts
|
#: src/user/user-settings/details/UserDetailsForm.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/sources/SourceSettings.ts
|
#: src/user/user-settings/sources/SourceSettings.ts
|
||||||
#: src/utils.ts
|
#: src/utils.ts
|
||||||
msgid "Loading"
|
msgid "Loading"
|
||||||
|
@ -2821,6 +2817,7 @@ msgstr "My applications"
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/pages/users/UserViewPage.ts
|
#: src/pages/users/UserViewPage.ts
|
||||||
#: src/user/user-settings/details/UserDetailsForm.ts
|
#: src/user/user-settings/details/UserDetailsForm.ts
|
||||||
|
#: src/user/user-settings/mfa/MFADeviceForm.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
@ -4061,9 +4058,9 @@ msgstr "Something went wrong! Please try again later."
|
||||||
msgid "Source linked"
|
msgid "Source linked"
|
||||||
msgstr "Source linked"
|
msgstr "Source linked"
|
||||||
|
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
#:
|
||||||
msgid "Source name"
|
#~ msgid "Source name"
|
||||||
msgstr "Source name"
|
#~ msgstr "Source name"
|
||||||
|
|
||||||
#: src/user/user-settings/sources/SourceSettingsOAuth.ts
|
#: src/user/user-settings/sources/SourceSettingsOAuth.ts
|
||||||
#: src/user/user-settings/sources/SourceSettingsPlex.ts
|
#: src/user/user-settings/sources/SourceSettingsPlex.ts
|
||||||
|
@ -4436,9 +4433,9 @@ msgstr "Successfully updated certificate-key pair."
|
||||||
msgid "Successfully updated details."
|
msgid "Successfully updated details."
|
||||||
msgstr "Successfully updated details."
|
msgstr "Successfully updated details."
|
||||||
|
|
||||||
#:
|
#: src/user/user-settings/mfa/MFADeviceForm.ts
|
||||||
#~ msgid "Successfully updated device."
|
msgid "Successfully updated device."
|
||||||
#~ msgstr "Successfully updated device."
|
msgstr "Successfully updated device."
|
||||||
|
|
||||||
#: src/pages/flows/FlowForm.ts
|
#: src/pages/flows/FlowForm.ts
|
||||||
msgid "Successfully updated flow."
|
msgid "Successfully updated flow."
|
||||||
|
@ -5056,7 +5053,6 @@ msgstr "Up-to-date!"
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/pages/users/UserViewPage.ts
|
#: src/pages/users/UserViewPage.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/tokens/UserTokenList.ts
|
#: src/user/user-settings/tokens/UserTokenList.ts
|
||||||
msgid "Update"
|
msgid "Update"
|
||||||
msgstr "Update"
|
msgstr "Update"
|
||||||
|
@ -5075,7 +5071,6 @@ msgid "Update Certificate-Key Pair"
|
||||||
msgstr "Update Certificate-Key Pair"
|
msgstr "Update Certificate-Key Pair"
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Update Device"
|
msgid "Update Device"
|
||||||
msgstr "Update Device"
|
msgstr "Update Device"
|
||||||
|
|
||||||
|
|
|
@ -1286,7 +1286,6 @@ msgstr "Définit les méthodes d'envoi des notifications aux utilisateurs, telle
|
||||||
#: src/pages/tokens/TokenListPage.ts
|
#: src/pages/tokens/TokenListPage.ts
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/tokens/UserTokenList.ts
|
#: src/user/user-settings/tokens/UserTokenList.ts
|
||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr "Supprimer"
|
msgstr "Supprimer"
|
||||||
|
@ -1386,7 +1385,6 @@ msgstr "Classe d'équipement qui peut être utilisé pour s'authentifier"
|
||||||
#~ msgstr "Nom de l'équipement"
|
#~ msgstr "Nom de l'équipement"
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Device(s)"
|
msgid "Device(s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1603,7 +1601,6 @@ msgid "Enabling this toggle will create a group named after the user, with the u
|
||||||
msgstr "Activer cette option va créer un groupe du même nom que l'utilisateur dont il sera membre."
|
msgstr "Activer cette option va créer un groupe du même nom que l'utilisateur dont il sera membre."
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Enroll"
|
msgid "Enroll"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2484,7 +2481,6 @@ msgstr "Charger les serveurs"
|
||||||
#: src/pages/applications/ApplicationViewPage.ts
|
#: src/pages/applications/ApplicationViewPage.ts
|
||||||
#: src/user/user-settings/details/UserDetailsForm.ts
|
#: src/user/user-settings/details/UserDetailsForm.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/sources/SourceSettings.ts
|
#: src/user/user-settings/sources/SourceSettings.ts
|
||||||
#: src/utils.ts
|
#: src/utils.ts
|
||||||
msgid "Loading"
|
msgid "Loading"
|
||||||
|
@ -2801,6 +2797,7 @@ msgstr "Mes applications"
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/pages/users/UserViewPage.ts
|
#: src/pages/users/UserViewPage.ts
|
||||||
#: src/user/user-settings/details/UserDetailsForm.ts
|
#: src/user/user-settings/details/UserDetailsForm.ts
|
||||||
|
#: src/user/user-settings/mfa/MFADeviceForm.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Nom"
|
msgstr "Nom"
|
||||||
|
@ -4021,9 +4018,9 @@ msgstr "Une erreur s'est produite ! Veuillez réessayer plus tard."
|
||||||
msgid "Source linked"
|
msgid "Source linked"
|
||||||
msgstr "Source liée"
|
msgstr "Source liée"
|
||||||
|
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
#:
|
||||||
msgid "Source name"
|
#~ msgid "Source name"
|
||||||
msgstr ""
|
#~ msgstr ""
|
||||||
|
|
||||||
#: src/user/user-settings/sources/SourceSettingsOAuth.ts
|
#: src/user/user-settings/sources/SourceSettingsOAuth.ts
|
||||||
#: src/user/user-settings/sources/SourceSettingsPlex.ts
|
#: src/user/user-settings/sources/SourceSettingsPlex.ts
|
||||||
|
@ -4392,9 +4389,9 @@ msgstr "Paire clé/certificat mise à jour avec succès."
|
||||||
msgid "Successfully updated details."
|
msgid "Successfully updated details."
|
||||||
msgstr "Détails mis à jour avec succès"
|
msgstr "Détails mis à jour avec succès"
|
||||||
|
|
||||||
#:
|
#: src/user/user-settings/mfa/MFADeviceForm.ts
|
||||||
#~ msgid "Successfully updated device."
|
msgid "Successfully updated device."
|
||||||
#~ msgstr "Appareil mis à jour avec succès"
|
msgstr "Appareil mis à jour avec succès"
|
||||||
|
|
||||||
#: src/pages/flows/FlowForm.ts
|
#: src/pages/flows/FlowForm.ts
|
||||||
msgid "Successfully updated flow."
|
msgid "Successfully updated flow."
|
||||||
|
@ -4997,7 +4994,6 @@ msgstr "À jour !"
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/pages/users/UserViewPage.ts
|
#: src/pages/users/UserViewPage.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/tokens/UserTokenList.ts
|
#: src/user/user-settings/tokens/UserTokenList.ts
|
||||||
msgid "Update"
|
msgid "Update"
|
||||||
msgstr "Mettre à jour"
|
msgstr "Mettre à jour"
|
||||||
|
@ -5016,7 +5012,6 @@ msgid "Update Certificate-Key Pair"
|
||||||
msgstr "Mettre à jour la paire clé/certificat"
|
msgstr "Mettre à jour la paire clé/certificat"
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Update Device"
|
msgid "Update Device"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1282,7 +1282,6 @@ msgstr ""
|
||||||
#: src/pages/tokens/TokenListPage.ts
|
#: src/pages/tokens/TokenListPage.ts
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/tokens/UserTokenList.ts
|
#: src/user/user-settings/tokens/UserTokenList.ts
|
||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1388,7 +1387,6 @@ msgstr ""
|
||||||
#~ msgstr ""
|
#~ msgstr ""
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Device(s)"
|
msgid "Device(s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1609,7 +1607,6 @@ msgid "Enabling this toggle will create a group named after the user, with the u
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Enroll"
|
msgid "Enroll"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2495,7 +2492,6 @@ msgstr ""
|
||||||
#: src/pages/applications/ApplicationViewPage.ts
|
#: src/pages/applications/ApplicationViewPage.ts
|
||||||
#: src/user/user-settings/details/UserDetailsForm.ts
|
#: src/user/user-settings/details/UserDetailsForm.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/sources/SourceSettings.ts
|
#: src/user/user-settings/sources/SourceSettings.ts
|
||||||
#: src/utils.ts
|
#: src/utils.ts
|
||||||
msgid "Loading"
|
msgid "Loading"
|
||||||
|
@ -2813,6 +2809,7 @@ msgstr ""
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/pages/users/UserViewPage.ts
|
#: src/pages/users/UserViewPage.ts
|
||||||
#: src/user/user-settings/details/UserDetailsForm.ts
|
#: src/user/user-settings/details/UserDetailsForm.ts
|
||||||
|
#: src/user/user-settings/mfa/MFADeviceForm.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -4053,9 +4050,9 @@ msgstr ""
|
||||||
msgid "Source linked"
|
msgid "Source linked"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
#:
|
||||||
msgid "Source name"
|
#~ msgid "Source name"
|
||||||
msgstr ""
|
#~ msgstr ""
|
||||||
|
|
||||||
#: src/user/user-settings/sources/SourceSettingsOAuth.ts
|
#: src/user/user-settings/sources/SourceSettingsOAuth.ts
|
||||||
#: src/user/user-settings/sources/SourceSettingsPlex.ts
|
#: src/user/user-settings/sources/SourceSettingsPlex.ts
|
||||||
|
@ -4428,9 +4425,9 @@ msgstr ""
|
||||||
msgid "Successfully updated details."
|
msgid "Successfully updated details."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#:
|
#: src/user/user-settings/mfa/MFADeviceForm.ts
|
||||||
#~ msgid "Successfully updated device."
|
msgid "Successfully updated device."
|
||||||
#~ msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/flows/FlowForm.ts
|
#: src/pages/flows/FlowForm.ts
|
||||||
msgid "Successfully updated flow."
|
msgid "Successfully updated flow."
|
||||||
|
@ -5041,7 +5038,6 @@ msgstr ""
|
||||||
#: src/pages/users/UserListPage.ts
|
#: src/pages/users/UserListPage.ts
|
||||||
#: src/pages/users/UserViewPage.ts
|
#: src/pages/users/UserViewPage.ts
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
#: src/user/user-settings/tokens/UserTokenList.ts
|
#: src/user/user-settings/tokens/UserTokenList.ts
|
||||||
msgid "Update"
|
msgid "Update"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -5060,7 +5056,6 @@ msgid "Update Certificate-Key Pair"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
#: src/user/user-settings/mfa/MFADevicesPage.ts
|
||||||
#: src/user/user-settings/sources/SourceConnectionsPage.ts
|
|
||||||
msgid "Update Device"
|
msgid "Update Device"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
75
web/src/user/user-settings/mfa/MFADeviceForm.ts
Normal file
75
web/src/user/user-settings/mfa/MFADeviceForm.ts
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
import { t } from "@lingui/macro";
|
||||||
|
|
||||||
|
import { TemplateResult, html } from "lit";
|
||||||
|
import { customElement } from "lit/decorators";
|
||||||
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
|
|
||||||
|
import { AuthenticatorsApi, Device } from "@goauthentik/api";
|
||||||
|
|
||||||
|
import { DEFAULT_CONFIG } from "../../../api/Config";
|
||||||
|
import "../../../elements/forms/HorizontalFormElement";
|
||||||
|
import { ModelForm } from "../../../elements/forms/ModelForm";
|
||||||
|
|
||||||
|
@customElement("ak-user-mfa-form")
|
||||||
|
export class MFADeviceForm extends ModelForm<Device, number> {
|
||||||
|
loadInstance(pk: number): Promise<Device> {
|
||||||
|
return new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsAllList().then((devices) => {
|
||||||
|
return devices.filter((device) => device.pk === pk)[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getSuccessMessage(): string {
|
||||||
|
return t`Successfully updated device.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
send = async (device: Device): Promise<Device> => {
|
||||||
|
switch (this.instance?.type) {
|
||||||
|
case "authentik_stages_authenticator_duo.DuoDevice":
|
||||||
|
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsDuoUpdate({
|
||||||
|
id: this.instance?.pk,
|
||||||
|
duoDeviceRequest: device,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "authentik_stages_authenticator_sms.SMSDevice":
|
||||||
|
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsSmsUpdate({
|
||||||
|
id: this.instance?.pk,
|
||||||
|
sMSDeviceRequest: device,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "otp_totp.TOTPDevice":
|
||||||
|
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsTotpUpdate({
|
||||||
|
id: this.instance?.pk,
|
||||||
|
tOTPDeviceRequest: device,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "otp_static.StaticDevice":
|
||||||
|
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsStaticUpdate({
|
||||||
|
id: this.instance?.pk,
|
||||||
|
staticDeviceRequest: device,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "authentik_stages_authenticator_webauthn.WebAuthnDevice":
|
||||||
|
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsWebauthnUpdate({
|
||||||
|
id: this.instance?.pk,
|
||||||
|
webAuthnDeviceRequest: device,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return device;
|
||||||
|
};
|
||||||
|
|
||||||
|
renderForm(): TemplateResult {
|
||||||
|
return html`<form class="pf-c-form pf-m-horizontal">
|
||||||
|
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value="${ifDefined(this.instance?.name)}"
|
||||||
|
class="pf-c-form-control"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</ak-form-element-horizontal>
|
||||||
|
</form>`;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ import { t } from "@lingui/macro";
|
||||||
|
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import { until } from "lit/directives/until";
|
import { until } from "lit/directives/until";
|
||||||
|
|
||||||
import { AuthenticatorsApi, Device, UserSetting } from "@goauthentik/api";
|
import { AuthenticatorsApi, Device, UserSetting } from "@goauthentik/api";
|
||||||
|
@ -14,6 +15,7 @@ import "../../../elements/buttons/TokenCopyButton";
|
||||||
import "../../../elements/forms/DeleteBulkForm";
|
import "../../../elements/forms/DeleteBulkForm";
|
||||||
import "../../../elements/forms/ModalForm";
|
import "../../../elements/forms/ModalForm";
|
||||||
import { Table, TableColumn } from "../../../elements/table/Table";
|
import { Table, TableColumn } from "../../../elements/table/Table";
|
||||||
|
import "./MFADeviceForm";
|
||||||
|
|
||||||
export function stageToAuthenticatorName(stage: UserSetting): string {
|
export function stageToAuthenticatorName(stage: UserSetting): string {
|
||||||
switch (stage.component) {
|
switch (stage.component) {
|
||||||
|
@ -76,7 +78,7 @@ export class MFADevicesPage extends Table<Device> {
|
||||||
.map((stage) => {
|
.map((stage) => {
|
||||||
return html`<li>
|
return html`<li>
|
||||||
<a
|
<a
|
||||||
href="${stage.configureUrl}"
|
href="${ifDefined(stage.configureUrl)}"
|
||||||
class="pf-c-dropdown__menu-item"
|
class="pf-c-dropdown__menu-item"
|
||||||
>
|
>
|
||||||
${stageToAuthenticatorName(stage)}
|
${stageToAuthenticatorName(stage)}
|
||||||
|
@ -144,7 +146,7 @@ export class MFADevicesPage extends Table<Device> {
|
||||||
<ak-forms-modal>
|
<ak-forms-modal>
|
||||||
<span slot="submit">${t`Update`}</span>
|
<span slot="submit">${t`Update`}</span>
|
||||||
<span slot="header">${t`Update Device`}</span>
|
<span slot="header">${t`Update Device`}</span>
|
||||||
<ak-user-token-form slot="form" .instancePk=${item.pk}> </ak-user-token-form>
|
<ak-user-mfa-form slot="form" .instancePk=${item.pk}> </ak-user-mfa-form>
|
||||||
<button slot="trigger" class="pf-c-button pf-m-plain">
|
<button slot="trigger" class="pf-c-button pf-m-plain">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
Reference in a new issue