@@ -55,22 +72,15 @@ export class UserSettingsPage extends LitElement { ${until(new StagesApi(DEFAULT_CONFIG).stagesAllUserSettings({}).then((stages) => { return stages.map((stage) => { - // TODO: Check for non-shell stages - return html`
-
-
- -
-
-
-
-
`; + return html`
+ ${this.renderStageSettings(stage)} +
`; }); }))} ${until(new SourcesApi(DEFAULT_CONFIG).sourcesAllUserSettings({}).then((sources) => { return sources.map((source) => { // TODO: Check for non-shell sources - return html`
+ return html`
diff --git a/web/src/pages/users/settings/AuthenticatorWebAuthnDevices.ts b/web/src/pages/users/settings/AuthenticatorWebAuthnDevices.ts new file mode 100644 index 000000000..a47704a6f --- /dev/null +++ b/web/src/pages/users/settings/AuthenticatorWebAuthnDevices.ts @@ -0,0 +1,79 @@ +import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; +import PFBase from "@patternfly/patternfly/patternfly-base.css"; +import PFCard from "@patternfly/patternfly/components/Card/card.css"; +import PFDataList from "@patternfly/patternfly/components/DataList/data-list.css"; +import PFButton from "@patternfly/patternfly/components/Button/button.css"; +import AKGlobal from "../../../authentik.css"; +import { gettext } from "django"; +import { AuthenticatorsApi, StagesApi } from "authentik-api"; +import { until } from "lit-html/directives/until"; +import { FlowURLManager, UserURLManager } from "../../../api/legacy"; +import { DEFAULT_CONFIG } from "../../../api/Config"; + +@customElement("ak-user-settings-authenticator-webauthn") +export class UserSettingsAuthenticatorWebAuthnDevices extends LitElement { + + @property() + stageId!: string; + + static get styles(): CSSResult[] { + return [PFBase, PFCard, PFButton, PFDataList, AKGlobal]; + } + + render(): TemplateResult { + return html`
+
+ ${gettext("WebAuthn Devices")} +
+
+
    + ${until(new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsWebauthnList({}).then((devices) => { + return devices.results.map((device) => { + return html`
  • +
    +
    +
    ${device.name || "-"}
    +
    + ${gettext(`Created ${device.createdOn?.toLocaleString()}`)} +
    +
    + + + ${gettext('Update')} + +
    +
    + { + return new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsWebauthnDelete({ + id: device.pk || 0 + }); + }}> + + +
    +
    +
    +
  • `; + }); + }))} +
+
+ +
`; + } + +}