diff --git a/web/src/pages/user-settings/UserSettingsPage.ts b/web/src/pages/user-settings/UserSettingsPage.ts index d475167d2..8f474ff03 100644 --- a/web/src/pages/user-settings/UserSettingsPage.ts +++ b/web/src/pages/user-settings/UserSettingsPage.ts @@ -56,7 +56,7 @@ export class UserSettingsPage extends LitElement { renderSourceSettings(source: UserSetting): TemplateResult { switch (source.component) { case "ak-user-settings-source-oauth": - return html` + return html` `; default: return html`

${t`Error: unsupported source settings: ${source.component}`}

`; diff --git a/web/src/pages/user-settings/settings/SourceSettingsOAuth.ts b/web/src/pages/user-settings/settings/SourceSettingsOAuth.ts index cd41a465b..a3d1eeeff 100644 --- a/web/src/pages/user-settings/settings/SourceSettingsOAuth.ts +++ b/web/src/pages/user-settings/settings/SourceSettingsOAuth.ts @@ -1,6 +1,6 @@ -import { customElement, html, TemplateResult } from "lit-element"; +import { customElement, html, property, TemplateResult } from "lit-element"; import { BaseUserSettings } from "./BaseUserSettings"; -import { OAuthSource, SourcesApi } from "authentik-api"; +import { SourcesApi } from "authentik-api"; import { until } from "lit-html/directives/until"; import { DEFAULT_CONFIG } from "../../../api/Config"; import { t } from "@lingui/macro"; @@ -9,22 +9,21 @@ import { AppURLManager } from "../../../api/legacy"; @customElement("ak-user-settings-source-oauth") export class SourceSettingsOAuth extends BaseUserSettings { + @property() + title!: string; + render(): TemplateResult { - return html`${until(new SourcesApi(DEFAULT_CONFIG).sourcesOauthRead({ - slug: this.objectId - }).then((source) => { - return html`
-
- ${t`Source ${source.name}`} -
-
- ${this.renderInner(source)} -
-
`; - }))}`; + return html`
+
+ ${t`Source ${this.title}`} +
+
+ ${this.renderInner()} +
+
`; } - renderInner(source: OAuthSource): TemplateResult { + renderInner(): TemplateResult { return html`${until(new SourcesApi(DEFAULT_CONFIG).sourcesOauthUserConnectionsList({ sourceSlug: this.objectId }).then((connection) => { @@ -41,7 +40,7 @@ export class SourceSettingsOAuth extends BaseUserSettings { } return html`

${t`Not connected.`}

+ href=${AppURLManager.sourceOAuth(this.objectId, "login")}> ${t`Connect`} `; }))}`;