fix web stuff

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-12-28 15:12:27 +01:00
parent d0d3ae9218
commit 89fbea3305
No known key found for this signature in database
2 changed files with 41 additions and 32 deletions

View File

@ -10,8 +10,9 @@ import "@goauthentik/elements/forms/SearchSelect";
import "@goauthentik/elements/utils/TimeDeltaHelp"; import "@goauthentik/elements/utils/TimeDeltaHelp";
import { msg } from "@lit/localize"; import { msg } from "@lit/localize";
import { TemplateResult, html } from "lit"; import { CSSResult, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators.js"; 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 PFList from "@patternfly/patternfly/components/List/list.css";
@ -45,47 +46,55 @@ export class AdminSettingsForm extends Form<SettingsRequest> {
<ak-text-input <ak-text-input
name="avatars" name="avatars"
label=${msg("Avatars")} label=${msg("Avatars")}
value="${this._settings?.avatars}" value="${ifDefined(this._settings?.avatars)}"
.bighelp=${html` .bighelp=${html`
<p class="pf-c-form__helper-text"> <p class="pf-c-form__helper-text">
${msg( ${msg(
"Configure how authentik should show avatars for users. The following values can be set:", "Configure how authentik should show avatars for users. The following values can be set:",
)} )}
</p> </p>
<p class="pf-c-form__helper-text"> <ul class="pf-c-list">
<ul class="pf-c-list"> <li class="pf-c-form__helper-text">
<li class="pf-c-form__helper-text"><code>none</code>: ${msg( <code>none</code>:
${msg(
"Disables per-user avatars and just shows a 1x1 pixel transparent picture", "Disables per-user avatars and just shows a 1x1 pixel transparent picture",
)}</li> )}
<li class="pf-c-form__helper-text"><code>gravatar</code>: ${msg( </li>
"Uses gravatar with the user's email address", <li class="pf-c-form__helper-text">
)}</li> <code>gravatar</code>:
<li class="pf-c-form__helper-text"><code>initials</code>: ${msg( ${msg("Uses gravatar with the user's email address")}
"Generated avatars based on the user's name", </li>
)}</li> <li class="pf-c-form__helper-text">
<li class="pf-c-form__helper-text">${msg( <code>initials</code>:
${msg("Generated avatars based on the user's name")}
</li>
<li class="pf-c-form__helper-text">
${msg(
"Any URL: If you want to use images hosted on another server, you can set any URL. Additionally, these placeholders can be used:", "Any URL: If you want to use images hosted on another server, you can set any URL. Additionally, these placeholders can be used:",
)} )}
<ul class="pf-c-list"> <ul class="pf-c-list">
<li class="pf-c-form__helper-text"><code>%(username)s</code>: ${msg( <li class="pf-c-form__helper-text">
"The user's username", <code>%(username)s</code>: ${msg("The user's username")}
)}</li> </li>
<li class="pf-c-form__helper-text"><code>%(mail_hash)s</code>: ${msg( <li class="pf-c-form__helper-text">
"The email address, md5 hashed", <code>%(mail_hash)s</code>:
)}</li> ${msg("The email address, md5 hashed")}
<li class="pf-c-form__helper-text"><code>%(upn)s</code>: ${msg( </li>
"The user's UPN, if set (otherwise an empty string)", <li class="pf-c-form__helper-text">
)}</li> <code>%(upn)s</code>:
</ul> ${msg("The user's UPN, if set (otherwise an empty string)")}
</li> </li>
<li class="pf-c-form__helper-text">${msg( </ul>
</li>
<li class="pf-c-form__helper-text">
${msg(
html`An attribute path like html`An attribute path like
<code>attributes.something.avatar</code>, which can be used in <code>attributes.something.avatar</code>, which can be used in
combination with the file field to allow users to upload custom combination with the file field to allow users to upload custom
avatars for themselves.`, avatars for themselves.`,
)}</li> )}
</ul> </li>
</p> </ul>
<p class="pf-c-form__helper-text"> <p class="pf-c-form__helper-text">
${msg( ${msg(
"Multiple values can be set, comma-separated, and authentik will fallback to the next mode when no avatar could be found.", "Multiple values can be set, comma-separated, and authentik will fallback to the next mode when no avatar could be found.",
@ -125,7 +134,7 @@ export class AdminSettingsForm extends Form<SettingsRequest> {
name="eventRetention" name="eventRetention"
label=${msg("Event retention")} label=${msg("Event retention")}
required required
value="${this._settings?.eventRetention}" value="${ifDefined(this._settings?.eventRetention)}"
.bighelp=${html`<p class="pf-c-form__helper-text"> .bighelp=${html`<p class="pf-c-form__helper-text">
${msg("Duration after which events will be deleted from the database.")} ${msg("Duration after which events will be deleted from the database.")}
</p> </p>

View File

@ -59,7 +59,7 @@ export class AdminSettingsPage extends AKElement {
this.loadSettings(); this.loadSettings();
} }
async save(): void { async save(): Promise<void> {
const form = this.shadowRoot?.querySelector<AdminSettingsForm>("ak-admin-settings-form"); const form = this.shadowRoot?.querySelector<AdminSettingsForm>("ak-admin-settings-form");
if (!form) { if (!form) {
return; return;
@ -74,7 +74,7 @@ export class AdminSettingsPage extends AKElement {
return; return;
} }
this.loadSettings(); this.loadSettings();
form.settings = this.settings; form.settings = this.settings!;
form.resetForm(); form.resetForm();
} }