import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/components/ak-number-input"; import "@goauthentik/components/ak-switch-input"; import "@goauthentik/components/ak-text-input"; import "@goauthentik/elements/CodeMirror"; import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror"; import { Form } from "@goauthentik/elements/forms/Form"; import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/HorizontalFormElement"; import "@goauthentik/elements/forms/Radio"; import "@goauthentik/elements/forms/SearchSelect"; import "@goauthentik/elements/utils/TimeDeltaHelp"; import { msg } from "@lit/localize"; import { CSSResult, TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import PFList from "@patternfly/patternfly/components/List/list.css"; import { AdminApi, Settings, SettingsRequest } from "@goauthentik/api"; @customElement("ak-admin-settings-form") export class AdminSettingsForm extends Form { // // Custom property accessors in Lit 2 require a manual call to requestUpdate(). See: // https://lit.dev/docs/v2/components/properties/#accessors-custom // set settings(value: Settings | undefined) { this._settings = value; this.requestUpdate(); } @property({ type: Object }) get settings() { return this._settings; } private _settings?: Settings; static get styles(): CSSResult[] { return super.styles.concat(PFList); } getSuccessMessage(): string { return msg("Successfully updated settings."); } async send(data: SettingsRequest): Promise { const result = await new AdminApi(DEFAULT_CONFIG).adminSettingsUpdate({ settingsRequest: data, }); this.dispatchEvent(new CustomEvent("ak-admin-setting-changed")); return result; } renderForm(): TemplateResult { return html` ${msg( "Configure how authentik should show avatars for users. The following values can be set:", )}

  • none: ${msg( "Disables per-user avatars and just shows a 1x1 pixel transparent picture", )}
  • gravatar: ${msg("Uses gravatar with the user's email address")}
  • initials: ${msg("Generated avatars based on the user's name")}
  • ${msg( "Any URL: If you want to use images hosted on another server, you can set any URL. Additionally, these placeholders can be used:", )}
    • %(username)s: ${msg("The user's username")}
    • %(mail_hash)s: ${msg("The email address, md5 hashed")}
    • %(upn)s: ${msg("The user's UPN, if set (otherwise an empty string)")}
  • ${msg( html`An attribute path like attributes.something.avatar, which can be used in combination with the file field to allow users to upload custom avatars for themselves.`, )}

${msg( "Multiple values can be set, comma-separated, and authentik will fallback to the next mode when no avatar could be found.", )} ${msg( html`For example, setting this to gravatar,initials will attempt to get an avatar from Gravatar, and if the user has not configured on there, it will fallback to a generated avatar.`, )}

`} required >
${msg("Duration after which events will be deleted from the database.")}

${msg( 'When using an external logging solution for archiving, this can be set to "minutes=5".', )}

${msg( "This setting only affects new Events, as the expiration is saved per-event.", )}

`} >

${msg( "This option configures the footer links on the flow executor pages. It must be a valid YAML or JSON list and can be used as follows:", )} [{"name": "Link Name","href":"https://goauthentik.io"}]

${msg("Default duration for generated tokens")}

`} >
`; } } declare global { interface HTMLElementTagNameMap { "ak-admin-settings-form": AdminSettingsForm; } }