web: Replace lingui.js with lit-localize (#5761)
* \#\# Details
web: replace lingui with lit/localize
\#\# Changes
This rather massive shift replaces the lingui and `t()` syntax with lit-localize, XLIFF, and the `msg()`
syntax used by lit-localize. 90% of this work was mechanized; simple perl scripts found and replaced
all uses of `t()` with the appropriate corresponding syntax for `msg()` and `msg(str())`.
The XLIFF files were auto-generated from the PO files. They have not been audited, and they should be
checked over by professional translators. The actual _strings_ have not been changed, but as this was
a mechanized change there is always the possibility of mis-translation-- not by the translator, but by
the script.
* web: revise lit/localize: fix two installation issues.
* web: revise localization
TL;DR:
- Replaced all of Lingui's `t()` syntax with `msg()` syntax.
- Mechanically (i.e with a script) converted all of the PO files to XLIFF files
- Refactored the localization code to be a bit smarter:
- the function `getBestMatchLocale` takes the locale lists and a requested locale, and returns the
first match of:
- The locale's code exactly matches the requested locale
- The locale code exactly matches the prefix of the requested locale (i.e the "en" part of "en-US")
- the locale code's prefix exactly matches the prefix of the requested locale
This function is passed to lit-locate's `loadLocale()`.
- `activateLocale()` just calls `loadLocale()` now.
- `autodetectLanguage` searches the following, and picks the first that returns a valid locale
object, before passing it to `loadLocale()`:
- The User's settings
- A `?locale=` component found in `window.location.search`
- The `window.navigator.language` field
- English
The `msg()` only runs when it's run. This seems obvious, but it means that you cannot cache
strings at load time; they must be kept inside functions that are re-run so that the `msg()` engine
can look up the strings in the preferred language of the user at that moment.
You can use thunks-of-strings if you really need them that way.
* Including the 'xliff-converter' in case anyone wants to review it.
* The xliff-converter is tagged as 'xliff-converter', but has been
deleted.
\#\# Details
- Resolves #5171
\#\# Changes
\#\#\# New Features
- Adds a "Add an Application" to the LibraryView if there are no applications and the user is an administrator.
\#\#\# Breaking Changes
- Adds breaking change which causes \<issue\>.
\#\# Checklist
- [ ] Local tests pass (`ak test authentik/`)
- [ ] The code has been formatted (`make lint-fix`)
If an API change has been made
- [ ] The API schema has been updated (`make gen-build`)
If changes to the frontend have been made
- [ ] The code has been formatted (`make web`)
- [ ] The translation files have been updated (`make i18n-extract`)
If applicable
- [ ] The documentation has been updated
- [ ] The documentation has been formatted (`make website`)
* web: fix redundant locales for zh suite.
* web: prettier pass for locale update
* web: localization moderization
Changed the names of the lit-localize commands to make it clear they're
part of the localization effort, and not just "build" and "extract".
* update transifex config
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix package lock?
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* use build not compile
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* web: conversion to lit-localize
The CI produced a list of problems that I hadn't caught earlier,
due to a typo ("localize build" is correct, "localize compile" is
not) I had left in package.json. They were minor and linty, but
it was still wise to fix them.
* web: replace lingui with lit/locale
This commit fixes some minor linting issues that were hidden by a typo in package.json. The
issues were not apparently problematic from a Javascript point of view, but they pointed
to sloppy thinking in the progression of types through the system, so I cleaned them
up and formalized the types from LocaleModule to AkLocale.
* web: replace lingui with lit/localize
One problem that has repeatedly come up is that localize's templates do not produce
JavaScript that conforms with our shop style. I've replaced `build-locale` with
a two-step that builds the locale *and* ensures that it conforms to the shop style
via `prettier` every time.
* web: replace lingui with lit-locale
This commit applies the most recent bundle of translations to the
new lit-locale aspect component. It also revises the algorithm
for *finding* the correct locale, replacing the complex fall-back
with some rather straightforward regular expressions.
In the case of Chinese, the fallback comes at the end of the
selection list, which may not be, er, politically valuable
(since Taiwan and Hong Kong come before, being exceptions that
need to be tested). If we need a different order for presentation,
that'll be a future feature.
* web: replace lingui with lit/locale
Well, that was embarassing.
---------
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -13,8 +13,7 @@ import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
||||
import { TableColumn } from "@goauthentik/elements/table/Table";
|
||||
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -24,10 +23,12 @@ import { Source, SourcesApi } from "@goauthentik/api";
|
||||
@customElement("ak-source-list")
|
||||
export class SourceListPage extends TablePage<Source> {
|
||||
pageTitle(): string {
|
||||
return t`Federation & Social login`;
|
||||
return msg("Federation & Social login");
|
||||
}
|
||||
pageDescription(): string | undefined {
|
||||
return t`Sources of identities, which can either be synced into authentik's database, or can be used by users to authenticate and enroll themselves.`;
|
||||
return msg(
|
||||
"Sources of identities, which can either be synced into authentik's database, or can be used by users to authenticate and enroll themselves.",
|
||||
);
|
||||
}
|
||||
pageIcon(): string {
|
||||
return "pf-icon pf-icon-middleware";
|
||||
@ -51,13 +52,17 @@ export class SourceListPage extends TablePage<Source> {
|
||||
}
|
||||
|
||||
columns(): TableColumn[] {
|
||||
return [new TableColumn(t`Name`, "name"), new TableColumn(t`Type`), new TableColumn("")];
|
||||
return [
|
||||
new TableColumn(msg("Name"), "name"),
|
||||
new TableColumn(msg("Type")),
|
||||
new TableColumn(""),
|
||||
];
|
||||
}
|
||||
|
||||
renderToolbarSelected(): TemplateResult {
|
||||
const disabled = this.selectedElements.length < 1;
|
||||
return html`<ak-forms-delete-bulk
|
||||
objectLabel=${t`Source(s)`}
|
||||
objectLabel=${msg("Source(s)")}
|
||||
.objects=${this.selectedElements}
|
||||
.usedBy=${(item: Source) => {
|
||||
return new SourcesApi(DEFAULT_CONFIG).sourcesAllUsedByList({
|
||||
@ -71,7 +76,7 @@ export class SourceListPage extends TablePage<Source> {
|
||||
}}
|
||||
>
|
||||
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
|
||||
${t`Delete`}
|
||||
${msg("Delete")}
|
||||
</button>
|
||||
</ak-forms-delete-bulk>`;
|
||||
}
|
||||
@ -86,13 +91,13 @@ export class SourceListPage extends TablePage<Source> {
|
||||
${item.enabled
|
||||
? html``
|
||||
: html`<ak-label color=${PFColor.Orange} ?compact=${true}>
|
||||
${t`Disabled`}</ak-label
|
||||
${msg("Disabled")}</ak-label
|
||||
>`}
|
||||
</a>`,
|
||||
html`${item.verboseName}`,
|
||||
html` <ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update ${item.verboseName}`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg(str`Update ${item.verboseName}`)} </span>
|
||||
<ak-proxy-form
|
||||
slot="form"
|
||||
.args=${{
|
||||
@ -112,9 +117,9 @@ export class SourceListPage extends TablePage<Source> {
|
||||
return [
|
||||
html`<div>
|
||||
<div>${item.name}</div>
|
||||
<ak-label color=${PFColor.Grey} ?compact=${true}> ${t`Built-in`}</ak-label>
|
||||
<ak-label color=${PFColor.Grey} ?compact=${true}> ${msg("Built-in")}</ak-label>
|
||||
</div>`,
|
||||
html`${t`Built-in`}`,
|
||||
html`${msg("Built-in")}`,
|
||||
html``,
|
||||
];
|
||||
}
|
||||
|
||||
@ -9,8 +9,7 @@ import "@goauthentik/elements/wizard/FormWizardPage";
|
||||
import "@goauthentik/elements/wizard/Wizard";
|
||||
import { WizardPage } from "@goauthentik/elements/wizard/WizardPage";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { customElement } from "@lit/reactive-element/decorators/custom-element.js";
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { property } from "lit/decorators.js";
|
||||
@ -30,7 +29,7 @@ export class InitialSourceWizardPage extends WizardPage {
|
||||
static get styles(): CSSResult[] {
|
||||
return [PFBase, PFForm, PFButton, PFRadio];
|
||||
}
|
||||
sidebarLabel = () => t`Select type`;
|
||||
sidebarLabel = () => msg("Select type");
|
||||
|
||||
activeCallback: () => Promise<void> = async () => {
|
||||
this.host.isValid = false;
|
||||
@ -89,8 +88,8 @@ export class SourceWizard extends AKElement {
|
||||
return html`
|
||||
<ak-wizard
|
||||
.steps=${["initial"]}
|
||||
header=${t`New source`}
|
||||
description=${t`Create a new source.`}
|
||||
header=${msg("New source")}
|
||||
description=${msg("Create a new source.")}
|
||||
>
|
||||
<ak-source-wizard-initial slot="initial" .sourceTypes=${this.sourceTypes}>
|
||||
</ak-source-wizard-initial>
|
||||
@ -98,7 +97,7 @@ export class SourceWizard extends AKElement {
|
||||
return html`
|
||||
<ak-wizard-page-form
|
||||
slot=${`type-${type.component}-${type.modelName}`}
|
||||
.sidebarLabel=${() => t`Create ${type.name}`}
|
||||
.sidebarLabel=${() => msg(str`Create ${type.name}`)}
|
||||
>
|
||||
<ak-proxy-form
|
||||
.args=${{
|
||||
@ -109,7 +108,7 @@ export class SourceWizard extends AKElement {
|
||||
</ak-wizard-page-form>
|
||||
`;
|
||||
})}
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">${t`Create`}</button>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">${msg("Create")}</button>
|
||||
</ak-wizard>
|
||||
`;
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
@ -5,8 +6,7 @@ import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -45,9 +45,9 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return t`Successfully updated source.`;
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return t`Successfully created source.`;
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
|
||||
renderForm(): TemplateResult {
|
||||
return html`<form class="pf-c-form pf-m-horizontal">
|
||||
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.name)}"
|
||||
@ -74,7 +74,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
required
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Slug`} ?required=${true} name="slug">
|
||||
<ak-form-element-horizontal label=${msg("Slug")} ?required=${true} name="slug">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.slug)}"
|
||||
@ -94,7 +94,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Enabled`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Enabled")}</span>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal name="syncUsers">
|
||||
@ -109,7 +109,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Sync users`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Sync users")}</span>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal name="syncUsersPassword">
|
||||
@ -124,10 +124,12 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`User password writeback`}</span>
|
||||
<span class="pf-c-switch__label">${msg("User password writeback")}</span>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Login password is synced from LDAP into authentik automatically. Enable this option only to write password changes in authentik back to LDAP.`}
|
||||
${msg(
|
||||
"Login password is synced from LDAP into authentik automatically. Enable this option only to write password changes in authentik back to LDAP.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal name="syncGroups">
|
||||
@ -142,14 +144,14 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Sync groups`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Sync groups")}</span>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-group .expanded=${true}>
|
||||
<span slot="header"> ${t`Connection settings`} </span>
|
||||
<span slot="header"> ${msg("Connection settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Server URI`}
|
||||
label=${msg("Server URI")}
|
||||
?required=${true}
|
||||
name="serverUri"
|
||||
>
|
||||
@ -161,7 +163,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Specify multiple server URIs by separating them with a comma.`}
|
||||
${msg("Specify multiple server URIs by separating them with a comma.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal name="startTls">
|
||||
@ -176,14 +178,14 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Enable StartTLS`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Enable StartTLS")}</span>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`To use SSL instead, use 'ldaps://' and disable this option.`}
|
||||
${msg("To use SSL instead, use 'ldaps://' and disable this option.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`TLS Verification Certificate`}
|
||||
label=${msg("TLS Verification Certificate")}
|
||||
name="peerCertificate"
|
||||
>
|
||||
<ak-search-select
|
||||
@ -215,10 +217,12 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`When connecting to an LDAP Server with TLS, certificates are not checked by default. Specify a keypair to validate the remote certificate.`}
|
||||
${msg(
|
||||
"When connecting to an LDAP Server with TLS, certificates are not checked by default. Specify a keypair to validate the remote certificate.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Bind CN`} name="bindCn">
|
||||
<ak-form-element-horizontal label=${msg("Bind CN")} name="bindCn">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.bindCn)}"
|
||||
@ -226,13 +230,17 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Bind Password`}
|
||||
label=${msg("Bind Password")}
|
||||
?writeOnly=${this.instance !== undefined}
|
||||
name="bindPassword"
|
||||
>
|
||||
<input type="text" value="" class="pf-c-form-control" />
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Base DN`} ?required=${true} name="baseDn">
|
||||
<ak-form-element-horizontal
|
||||
label=${msg("Base DN")}
|
||||
?required=${true}
|
||||
name="baseDn"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.baseDn)}"
|
||||
@ -243,10 +251,10 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
</div>
|
||||
</ak-form-group>
|
||||
<ak-form-group ?expanded=${true}>
|
||||
<span slot="header"> ${t`LDAP Attribute mapping`} </span>
|
||||
<span slot="header"> ${msg("LDAP Attribute mapping")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`User Property Mappings`}
|
||||
label=${msg("User Property Mappings")}
|
||||
?required=${true}
|
||||
name="propertyMappings"
|
||||
>
|
||||
@ -278,14 +286,14 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
})}
|
||||
</select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Property mappings used to user creation.`}
|
||||
${msg("Property mappings used to user creation.")}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Hold control/command to select multiple items.`}
|
||||
${msg("Hold control/command to select multiple items.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Group Property Mappings`}
|
||||
label=${msg("Group Property Mappings")}
|
||||
?required=${true}
|
||||
name="propertyMappingsGroup"
|
||||
>
|
||||
@ -312,18 +320,18 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
})}
|
||||
</select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Property mappings used to group creation.`}
|
||||
${msg("Property mappings used to group creation.")}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Hold control/command to select multiple items.`}
|
||||
${msg("Hold control/command to select multiple items.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
</ak-form-group>
|
||||
<ak-form-group>
|
||||
<span slot="header"> ${t`Additional settings`} </span>
|
||||
<span slot="header"> ${msg("Additional settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal label=${t`Group`} name="syncParentGroup">
|
||||
<ak-form-element-horizontal label=${msg("Group")} name="syncParentGroup">
|
||||
<ak-search-select
|
||||
.fetchObjects=${async (query?: string): Promise<Group[]> => {
|
||||
const args: CoreGroupsListRequest = {
|
||||
@ -350,10 +358,10 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Parent group for all the groups imported from LDAP.`}
|
||||
${msg("Parent group for all the groups imported from LDAP.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`User path`} name="userPathTemplate">
|
||||
<ak-form-element-horizontal label=${msg("User path")} name="userPathTemplate">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(
|
||||
@ -362,12 +370,10 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
)}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Path template for users created. Use placeholders like \`%(slug)s\` to insert the source slug.`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${placeholderHelperText}</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Addition User DN`}
|
||||
label=${msg("Addition User DN")}
|
||||
name="additionalUserDn"
|
||||
>
|
||||
<input
|
||||
@ -376,11 +382,11 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Additional user DN, prepended to the Base DN.`}
|
||||
${msg("Additional user DN, prepended to the Base DN.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Addition Group DN`}
|
||||
label=${msg("Addition Group DN")}
|
||||
name="additionalGroupDn"
|
||||
>
|
||||
<input
|
||||
@ -389,11 +395,11 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Additional group DN, prepended to the Base DN.`}
|
||||
${msg("Additional group DN, prepended to the Base DN.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`User object filter`}
|
||||
label=${msg("User object filter")}
|
||||
?required=${true}
|
||||
name="userObjectFilter"
|
||||
>
|
||||
@ -404,11 +410,11 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Consider Objects matching this filter to be Users.`}
|
||||
${msg("Consider Objects matching this filter to be Users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Group object filter`}
|
||||
label=${msg("Group object filter")}
|
||||
?required=${true}
|
||||
name="groupObjectFilter"
|
||||
>
|
||||
@ -419,11 +425,11 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Consider Objects matching this filter to be Groups.`}
|
||||
${msg("Consider Objects matching this filter to be Groups.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Group membership field`}
|
||||
label=${msg("Group membership field")}
|
||||
?required=${true}
|
||||
name="groupMembershipField"
|
||||
>
|
||||
@ -434,11 +440,13 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Field which contains members of a group. Note that if using the "memberUid" field, the value is assumed to contain a relative distinguished name. e.g. 'memberUid=some-user' instead of 'memberUid=cn=some-user,ou=groups,...'`}
|
||||
${msg(
|
||||
"Field which contains members of a group. Note that if using the \"memberUid\" field, the value is assumed to contain a relative distinguished name. e.g. 'memberUid=some-user' instead of 'memberUid=cn=some-user,ou=groups,...'",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Object uniqueness field`}
|
||||
label=${msg("Object uniqueness field")}
|
||||
?required=${true}
|
||||
name="objectUniquenessField"
|
||||
>
|
||||
@ -449,7 +457,7 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Field which contains a unique Identifier.`}
|
||||
${msg("Field which contains a unique Identifier.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
|
||||
@ -9,8 +9,7 @@ import "@goauthentik/elements/buttons/SpinnerButton";
|
||||
import "@goauthentik/elements/events/ObjectChangelog";
|
||||
import "@goauthentik/elements/forms/ModalForm";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
|
||||
@ -63,7 +62,7 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
return html`<ak-tabs>
|
||||
<section
|
||||
slot="page-overview"
|
||||
data-tab-title="${t`Overview`}"
|
||||
data-tab-title="${msg("Overview")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
@activate=${() => {
|
||||
new SourcesApi(DEFAULT_CONFIG)
|
||||
@ -81,7 +80,9 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
<dl class="pf-c-description-list pf-m-2-col-on-lg">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Name`}</span>
|
||||
<span class="pf-c-description-list__text"
|
||||
>${msg("Name")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -92,7 +93,7 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Server URI`}</span
|
||||
>${msg("Server URI")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -104,7 +105,7 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Base DN`}</span
|
||||
>${msg("Base DN")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -119,33 +120,35 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update LDAP Source`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg("Update LDAP Source")} </span>
|
||||
<ak-source-ldap-form slot="form" .instancePk=${this.source.slug}>
|
||||
</ak-source-ldap-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">
|
||||
${t`Edit`}
|
||||
${msg("Edit")}
|
||||
</button>
|
||||
</ak-forms-modal>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
<div class="pf-c-card__title">
|
||||
<p>${t`Sync status`}</p>
|
||||
<p>${msg("Sync status")}</p>
|
||||
</div>
|
||||
<div class="pf-c-card__body">
|
||||
${this.syncState.length < 1
|
||||
? html`<p>${t`Not synced yet.`}</p>`
|
||||
? html`<p>${msg("Not synced yet.")}</p>`
|
||||
: html`
|
||||
<ul class="pf-c-list">
|
||||
${this.syncState.map((task) => {
|
||||
let header = "";
|
||||
if (task.status === TaskStatusEnum.Warning) {
|
||||
header = t`Task finished with warnings`;
|
||||
header = msg("Task finished with warnings");
|
||||
} else if (task.status === TaskStatusEnum.Error) {
|
||||
header = t`Task finished with errors`;
|
||||
header = msg("Task finished with errors");
|
||||
} else {
|
||||
header = t`Last sync: ${task.taskFinishTimestamp.toLocaleString()}`;
|
||||
header = msg(
|
||||
str`Last sync: ${task.taskFinishTimestamp.toLocaleString()}`,
|
||||
);
|
||||
}
|
||||
return html`<li>
|
||||
<p>${task.taskName}</p>
|
||||
@ -179,7 +182,7 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
});
|
||||
}}
|
||||
>
|
||||
${t`Run sync again`}
|
||||
${msg("Run sync again")}
|
||||
</ak-action-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -187,7 +190,7 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<section
|
||||
slot="page-changelog"
|
||||
data-tab-title="${t`Changelog`}"
|
||||
data-tab-title="${msg("Changelog")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { Diagram } from "@goauthentik/elements/Diagram";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
import { OAuthSource, UserMatchingModeEnum } from "@goauthentik/api";
|
||||
@ -15,7 +14,7 @@ export class OAuthSourceDiagram extends Diagram {
|
||||
refreshHandler = (): void => {
|
||||
if (!this.source) return;
|
||||
const graph = ["graph LR"];
|
||||
graph.push(`source[${t`OAuth Source ${this.source.name}`}]`);
|
||||
graph.push(`source[${msg(str`OAuth Source ${this.source.name}`)}]`);
|
||||
graph.push(
|
||||
`source --> flow_manager["${UserMatchingModeToLabel(
|
||||
this.source.userMatchingMode || UserMatchingModeEnum.Identifier,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
@ -9,8 +10,7 @@ import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -65,9 +65,9 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return t`Successfully updated source.`;
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return t`Successfully created source.`;
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,10 +110,10 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
return html``;
|
||||
}
|
||||
return html` <ak-form-group .expanded=${true}>
|
||||
<span slot="header"> ${t`URL settings`} </span>
|
||||
<span slot="header"> ${msg("URL settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Authorization URL`}
|
||||
label=${msg("Authorization URL")}
|
||||
?required=${true}
|
||||
name="authorizationUrl"
|
||||
>
|
||||
@ -128,11 +128,11 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`URL the user is redirect to to consent the authorization.`}
|
||||
${msg("URL the user is redirect to to consent the authorization.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Access token URL`}
|
||||
label=${msg("Access token URL")}
|
||||
?required=${true}
|
||||
name="accessTokenUrl"
|
||||
>
|
||||
@ -147,11 +147,11 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`URL used by authentik to retrieve tokens.`}
|
||||
${msg("URL used by authentik to retrieve tokens.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Profile URL`}
|
||||
label=${msg("Profile URL")}
|
||||
?required=${true}
|
||||
name="profileUrl"
|
||||
>
|
||||
@ -166,12 +166,12 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`URL used by authentik to get user information.`}
|
||||
${msg("URL used by authentik to get user information.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
${this.providerType.requestTokenUrl
|
||||
? html`<ak-form-element-horizontal
|
||||
label=${t`Request token URL`}
|
||||
label=${msg("Request token URL")}
|
||||
name="requestTokenUrl"
|
||||
>
|
||||
<input
|
||||
@ -180,14 +180,16 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`URL used to request the initial token. This URL is only required for OAuth 1.`}
|
||||
${msg(
|
||||
"URL used to request the initial token. This URL is only required for OAuth 1.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal> `
|
||||
: html``}
|
||||
${this.providerType.slug === ProviderTypeEnum.Openidconnect
|
||||
? html`
|
||||
<ak-form-element-horizontal
|
||||
label=${t`OIDC Well-known URL`}
|
||||
label=${msg("OIDC Well-known URL")}
|
||||
name="oidcWellKnownUrl"
|
||||
>
|
||||
<input
|
||||
@ -196,27 +198,34 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`OIDC well-known configuration URL. Can be used to automatically configure the URLs above.`}
|
||||
${msg(
|
||||
"OIDC well-known configuration URL. Can be used to automatically configure the URLs above.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`OIDC JWKS URL`} name="oidcJwksUrl">
|
||||
<ak-form-element-horizontal
|
||||
label=${msg("OIDC JWKS URL")}
|
||||
name="oidcJwksUrl"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.oidcJwksUrl)}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`JSON Web Key URL. Keys from the URL will be used to validate JWTs from this source.`}
|
||||
${msg(
|
||||
"JSON Web Key URL. Keys from the URL will be used to validate JWTs from this source.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
|
||||
<ak-form-element-horizontal label=${t`OIDC JWKS`} name="oidcJwks">
|
||||
<ak-form-element-horizontal label=${msg("OIDC JWKS")} name="oidcJwks">
|
||||
<ak-codemirror
|
||||
mode="javascript"
|
||||
value="${JSON.stringify(first(this.instance?.oidcJwks, {}))}"
|
||||
>
|
||||
</ak-codemirror>
|
||||
<p class="pf-c-form__helper-text">${t`Raw JWKS data.`}</p>
|
||||
<p class="pf-c-form__helper-text">${msg("Raw JWKS data.")}</p>
|
||||
</ak-form-element-horizontal>
|
||||
`
|
||||
: html``}
|
||||
@ -226,7 +235,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
|
||||
renderForm(): TemplateResult {
|
||||
return html`<form class="pf-c-form pf-m-horizontal">
|
||||
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.name)}"
|
||||
@ -234,7 +243,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
required
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Slug`} ?required=${true} name="slug">
|
||||
<ak-form-element-horizontal label=${msg("Slug")} ?required=${true} name="slug">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.slug)}"
|
||||
@ -254,11 +263,11 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Enabled`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Enabled")}</span>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`User matching mode`}
|
||||
label=${msg("User matching mode")}
|
||||
?required=${true}
|
||||
name="userMatchingMode"
|
||||
>
|
||||
@ -300,7 +309,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
</option>
|
||||
</select>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`User path`} name="userPathTemplate">
|
||||
<ak-form-element-horizontal label=${msg("User path")} name="userPathTemplate">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(
|
||||
@ -309,17 +318,15 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
)}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Path template for users created. Use placeholders like \`%(slug)s\` to insert the source slug.`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${placeholderHelperText}</p>
|
||||
</ak-form-element-horizontal>
|
||||
${rootInterface()?.config?.capabilities.includes(CapabilitiesEnum.CanSaveMedia)
|
||||
? html`<ak-form-element-horizontal label=${t`Icon`} name="icon">
|
||||
? html`<ak-form-element-horizontal label=${msg("Icon")} name="icon">
|
||||
<input type="file" value="" class="pf-c-form-control" />
|
||||
${this.instance?.icon
|
||||
? html`
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Currently set to:`} ${this.instance?.icon}
|
||||
${msg("Currently set to:")} ${this.instance?.icon}
|
||||
</p>
|
||||
`
|
||||
: html``}
|
||||
@ -341,30 +348,30 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label"> ${t`Clear icon`} </span>
|
||||
<span class="pf-c-switch__label">
|
||||
${msg("Clear icon")}
|
||||
</span>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Delete currently set icon.`}
|
||||
${msg("Delete currently set icon.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
`
|
||||
: html``}`
|
||||
: html`<ak-form-element-horizontal label=${t`Icon`} name="icon">
|
||||
: html`<ak-form-element-horizontal label=${msg("Icon")} name="icon">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(this.instance?.icon, "")}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Either input a full URL, a relative path, or use 'fa://fa-test' to use the Font Awesome icon "fa-test".`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${iconHelperText}</p>
|
||||
</ak-form-element-horizontal>`}
|
||||
|
||||
<ak-form-group .expanded=${true}>
|
||||
<span slot="header"> ${t`Protocol settings`} </span>
|
||||
<span slot="header"> ${msg("Protocol settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Consumer key`}
|
||||
label=${msg("Consumer key")}
|
||||
?required=${true}
|
||||
name="consumerKey"
|
||||
>
|
||||
@ -376,31 +383,33 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Consumer secret`}
|
||||
label=${msg("Consumer secret")}
|
||||
?required=${true}
|
||||
?writeOnly=${this.instance !== undefined}
|
||||
name="consumerSecret"
|
||||
>
|
||||
<textarea class="pf-c-form-control"></textarea>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Scopes`} name="additionalScopes">
|
||||
<ak-form-element-horizontal label=${msg("Scopes")} name="additionalScopes">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(this.instance?.additionalScopes, "")}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Additional scopes to be passed to the OAuth Provider, separated by space. To replace existing scopes, prefix with *.`}
|
||||
${msg(
|
||||
"Additional scopes to be passed to the OAuth Provider, separated by space. To replace existing scopes, prefix with *.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
</ak-form-group>
|
||||
${this.renderUrlOptions()}
|
||||
<ak-form-group>
|
||||
<span slot="header"> ${t`Flow settings`} </span>
|
||||
<span slot="header"> ${msg("Flow settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Authentication flow`}
|
||||
label=${msg("Authentication flow")}
|
||||
?required=${true}
|
||||
name="authenticationFlow"
|
||||
>
|
||||
@ -442,11 +451,11 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Flow to use when authenticating existing users.`}
|
||||
${msg("Flow to use when authenticating existing users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Enrollment flow`}
|
||||
label=${msg("Enrollment flow")}
|
||||
?required=${true}
|
||||
name="enrollmentFlow"
|
||||
>
|
||||
@ -488,7 +497,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Flow to use when enrolling new users.`}
|
||||
${msg("Flow to use when enrolling new users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
|
||||
@ -10,8 +10,7 @@ import "@goauthentik/elements/buttons/SpinnerButton";
|
||||
import "@goauthentik/elements/events/ObjectChangelog";
|
||||
import "@goauthentik/elements/forms/ModalForm";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
@ -44,7 +43,7 @@ export function ProviderToLabel(provider?: ProviderTypeEnum): string {
|
||||
case ProviderTypeEnum.Mailcow:
|
||||
return "Mailcow";
|
||||
case ProviderTypeEnum.Openidconnect:
|
||||
return t`Generic OpenID Connect`;
|
||||
return msg("Generic OpenID Connect");
|
||||
case ProviderTypeEnum.Okta:
|
||||
return "Okta";
|
||||
case ProviderTypeEnum.Patreon:
|
||||
@ -56,7 +55,7 @@ export function ProviderToLabel(provider?: ProviderTypeEnum): string {
|
||||
case ProviderTypeEnum.Twitch:
|
||||
return "Twitch";
|
||||
case ProviderTypeEnum.UnknownDefaultOpenApi:
|
||||
return t`Unknown provider type`;
|
||||
return msg("Unknown provider type");
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,17 +94,19 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
return html`<ak-tabs>
|
||||
<section
|
||||
slot="page-overview"
|
||||
data-tab-title="${t`Overview`}"
|
||||
data-tab-title="${msg("Overview")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
<div class="pf-c-card__title">${t`Details`}</div>
|
||||
<div class="pf-c-card__title">${msg("Details")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<dl class="pf-c-description-list pf-m-2-col-on-lg">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Name`}</span>
|
||||
<span class="pf-c-description-list__text"
|
||||
>${msg("Name")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -116,7 +117,7 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Provider Type`}</span
|
||||
>${msg("Provider Type")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -128,7 +129,7 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Callback URL`}</span
|
||||
>${msg("Callback URL")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -140,7 +141,7 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Access Key`}</span
|
||||
>${msg("Access Key")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -152,7 +153,7 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Authorization URL`}</span
|
||||
>${msg("Authorization URL")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -165,7 +166,7 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Token URL`}</span
|
||||
>${msg("Token URL")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -179,18 +180,18 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update OAuth Source`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg("Update OAuth Source")} </span>
|
||||
<ak-source-oauth-form slot="form" .instancePk=${this.source.slug}>
|
||||
</ak-source-oauth-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">
|
||||
${t`Edit`}
|
||||
${msg("Edit")}
|
||||
</button>
|
||||
</ak-forms-modal>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
<div class="pf-c-card__title">${t`Diagram`}</div>
|
||||
<div class="pf-c-card__title">${msg("Diagram")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ak-source-oauth-diagram
|
||||
.source=${this.source}
|
||||
@ -201,7 +202,7 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<section
|
||||
slot="page-changelog"
|
||||
data-tab-title="${t`Changelog`}"
|
||||
data-tab-title="${msg("Changelog")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
@ -219,14 +220,16 @@ export class OAuthSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<div
|
||||
slot="page-policy-binding"
|
||||
data-tab-title="${t`Policy Bindings`}"
|
||||
data-tab-title="${msg("Policy Bindings")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
<div class="pf-c-card__title">
|
||||
${t`These bindings control which users can access this source.
|
||||
You can only use policies here as access is checked before the user is authenticated.`}
|
||||
${msg(
|
||||
`These bindings control which users can access this source.
|
||||
You can only use policies here as access is checked before the user is authenticated.`,
|
||||
)}
|
||||
</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ak-bound-policies-list .target=${this.source.pk} ?policyOnly=${true}>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { t } from "@lingui/macro";
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
import { UserMatchingModeEnum } from "@goauthentik/api";
|
||||
|
||||
@ -6,16 +6,24 @@ export function UserMatchingModeToLabel(mode?: UserMatchingModeEnum): string {
|
||||
if (!mode) return "";
|
||||
switch (mode) {
|
||||
case UserMatchingModeEnum.Identifier:
|
||||
return t`Link users on unique identifier`;
|
||||
return msg("Link users on unique identifier");
|
||||
case UserMatchingModeEnum.EmailLink:
|
||||
return t`Link to a user with identical email address. Can have security implications when a source doesn't validate email addresses`;
|
||||
return msg(
|
||||
"Link to a user with identical email address. Can have security implications when a source doesn't validate email addresses",
|
||||
);
|
||||
case UserMatchingModeEnum.EmailDeny:
|
||||
return t`Use the user's email address, but deny enrollment when the email address already exists`;
|
||||
return msg(
|
||||
"Use the user's email address, but deny enrollment when the email address already exists",
|
||||
);
|
||||
case UserMatchingModeEnum.UsernameLink:
|
||||
return t`Link to a user with identical username. Can have security implications when a username is used with another source`;
|
||||
return msg(
|
||||
"Link to a user with identical username. Can have security implications when a username is used with another source",
|
||||
);
|
||||
case UserMatchingModeEnum.UsernameDeny:
|
||||
return t`Use the user's username, but deny enrollment when the username already exists`;
|
||||
return msg(
|
||||
"Use the user's username, but deny enrollment when the username already exists",
|
||||
);
|
||||
case UserMatchingModeEnum.UnknownDefaultOpenApi:
|
||||
return t`Unknown user matching mode`;
|
||||
return msg("Unknown user matching mode");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||
import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex";
|
||||
@ -9,8 +10,7 @@ import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -55,9 +55,9 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return t`Successfully updated source.`;
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return t`Successfully created source.`;
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
this.doAuth();
|
||||
}}
|
||||
>
|
||||
${t`Load servers`}
|
||||
${msg("Load servers")}
|
||||
</button>`;
|
||||
}
|
||||
return html` <button
|
||||
@ -131,7 +131,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
this.doAuth();
|
||||
}}
|
||||
>
|
||||
${t`Re-authenticate with plex`}
|
||||
${msg("Re-authenticate with plex")}
|
||||
</button>
|
||||
<ak-form-element-horizontal name="allowFriends">
|
||||
<label class="pf-c-switch">
|
||||
@ -146,12 +146,14 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label"
|
||||
>${t`Allow friends to authenticate via Plex, even if you don't share any servers`}</span
|
||||
>${msg(
|
||||
"Allow friends to authenticate via Plex, even if you don't share any servers",
|
||||
)}</span
|
||||
>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Allowed servers`}
|
||||
label=${msg("Allowed servers")}
|
||||
?required=${true}
|
||||
name="allowedServers"
|
||||
>
|
||||
@ -168,17 +170,19 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
})}
|
||||
</select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Select which server a user has to be a member of to be allowed to authenticate.`}
|
||||
${msg(
|
||||
"Select which server a user has to be a member of to be allowed to authenticate.",
|
||||
)}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Hold control/command to select multiple items.`}
|
||||
${msg("Hold control/command to select multiple items.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>`;
|
||||
}
|
||||
|
||||
renderForm(): TemplateResult {
|
||||
return html`<form class="pf-c-form pf-m-horizontal">
|
||||
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.name)}"
|
||||
@ -186,7 +190,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
required
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Slug`} ?required=${true} name="slug">
|
||||
<ak-form-element-horizontal label=${msg("Slug")} ?required=${true} name="slug">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.slug)}"
|
||||
@ -206,11 +210,11 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Enabled`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Enabled")}</span>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`User matching mode`}
|
||||
label=${msg("User matching mode")}
|
||||
?required=${true}
|
||||
name="userMatchingMode"
|
||||
>
|
||||
@ -252,7 +256,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
</option>
|
||||
</select>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`User path`} name="userPathTemplate">
|
||||
<ak-form-element-horizontal label=${msg("User path")} name="userPathTemplate">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(
|
||||
@ -261,17 +265,15 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
)}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Path template for users created. Use placeholders like \`%(slug)s\` to insert the source slug.`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${placeholderHelperText}</p>
|
||||
</ak-form-element-horizontal>
|
||||
${rootInterface()?.config?.capabilities.includes(CapabilitiesEnum.CanSaveMedia)
|
||||
? html`<ak-form-element-horizontal label=${t`Icon`} name="icon">
|
||||
? html`<ak-form-element-horizontal label=${msg("Icon")} name="icon">
|
||||
<input type="file" value="" class="pf-c-form-control" />
|
||||
${this.instance?.icon
|
||||
? html`
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Currently set to:`} ${this.instance?.icon}
|
||||
${msg("Currently set to:")} ${this.instance?.icon}
|
||||
</p>
|
||||
`
|
||||
: html``}
|
||||
@ -293,29 +295,29 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label"> ${t`Clear icon`} </span>
|
||||
<span class="pf-c-switch__label">
|
||||
${msg("Clear icon")}
|
||||
</span>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Delete currently set icon.`}
|
||||
${msg("Delete currently set icon.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
`
|
||||
: html``}`
|
||||
: html`<ak-form-element-horizontal label=${t`Icon`} name="icon">
|
||||
: html`<ak-form-element-horizontal label=${msg("Icon")} name="icon">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(this.instance?.icon, "")}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Either input a full URL, a relative path, or use 'fa://fa-test' to use the Font Awesome icon "fa-test".`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${iconHelperText}</p>
|
||||
</ak-form-element-horizontal>`}
|
||||
<ak-form-group .expanded=${true}>
|
||||
<span slot="header"> ${t`Protocol settings`} </span>
|
||||
<span slot="header"> ${msg("Protocol settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Client ID`}
|
||||
label=${msg("Client ID")}
|
||||
?required=${true}
|
||||
name="clientId"
|
||||
>
|
||||
@ -330,10 +332,10 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
</div>
|
||||
</ak-form-group>
|
||||
<ak-form-group>
|
||||
<span slot="header"> ${t`Flow settings`} </span>
|
||||
<span slot="header"> ${msg("Flow settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Authentication flow`}
|
||||
label=${msg("Authentication flow")}
|
||||
?required=${true}
|
||||
name="authenticationFlow"
|
||||
>
|
||||
@ -375,11 +377,11 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Flow to use when authenticating existing users.`}
|
||||
${msg("Flow to use when authenticating existing users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Enrollment flow`}
|
||||
label=${msg("Enrollment flow")}
|
||||
?required=${true}
|
||||
name="enrollmentFlow"
|
||||
>
|
||||
@ -421,7 +423,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Flow to use when enrolling new users.`}
|
||||
${msg("Flow to use when enrolling new users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
|
||||
@ -9,8 +9,7 @@ import "@goauthentik/elements/buttons/SpinnerButton";
|
||||
import "@goauthentik/elements/events/ObjectChangelog";
|
||||
import "@goauthentik/elements/forms/ModalForm";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
@ -59,7 +58,7 @@ export class PlexSourceViewPage extends AKElement {
|
||||
return html`<ak-tabs>
|
||||
<section
|
||||
slot="page-overview"
|
||||
data-tab-title="${t`Overview`}"
|
||||
data-tab-title="${msg("Overview")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
@ -68,7 +67,9 @@ export class PlexSourceViewPage extends AKElement {
|
||||
<dl class="pf-c-description-list pf-m-2-col-on-lg">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Name`}</span>
|
||||
<span class="pf-c-description-list__text"
|
||||
>${msg("Name")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -80,12 +81,12 @@ export class PlexSourceViewPage extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update Plex Source`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg("Update Plex Source")} </span>
|
||||
<ak-source-plex-form slot="form" .instancePk=${this.source.slug}>
|
||||
</ak-source-plex-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">
|
||||
${t`Edit`}
|
||||
${msg("Edit")}
|
||||
</button>
|
||||
</ak-forms-modal>
|
||||
</div>
|
||||
@ -94,7 +95,7 @@ export class PlexSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<section
|
||||
slot="page-changelog"
|
||||
data-tab-title="${t`Changelog`}"
|
||||
data-tab-title="${msg("Changelog")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
@ -112,14 +113,16 @@ export class PlexSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<div
|
||||
slot="page-policy-binding"
|
||||
data-tab-title="${t`Policy Bindings`}"
|
||||
data-tab-title="${msg("Policy Bindings")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
<div class="pf-c-card__title">
|
||||
${t`These bindings control which users can access this source.
|
||||
You can only use policies here as access is checked before the user is authenticated.`}
|
||||
${msg(
|
||||
`These bindings control which users can access this source.
|
||||
You can only use policies here as access is checked before the user is authenticated.`,
|
||||
)}
|
||||
</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ak-bound-policies-list .target=${this.source.pk} ?policyOnly=${true}>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
@ -9,8 +10,7 @@ import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -48,9 +48,9 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return t`Successfully updated source.`;
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return t`Successfully created source.`;
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
|
||||
renderForm(): TemplateResult {
|
||||
return html`<form class="pf-c-form pf-m-horizontal">
|
||||
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.name)}"
|
||||
@ -97,7 +97,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
required
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Slug`} ?required=${true} name="slug">
|
||||
<ak-form-element-horizontal label=${msg("Slug")} ?required=${true} name="slug">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.slug)}"
|
||||
@ -117,11 +117,11 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Enabled`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Enabled")}</span>
|
||||
</label>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`User matching mode`}
|
||||
label=${msg("User matching mode")}
|
||||
?required=${true}
|
||||
name="userMatchingMode"
|
||||
>
|
||||
@ -164,12 +164,12 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
</select>
|
||||
</ak-form-element-horizontal>
|
||||
${rootInterface()?.config?.capabilities.includes(CapabilitiesEnum.CanSaveMedia)
|
||||
? html`<ak-form-element-horizontal label=${t`Icon`} name="icon">
|
||||
? html`<ak-form-element-horizontal label=${msg("Icon")} name="icon">
|
||||
<input type="file" value="" class="pf-c-form-control" />
|
||||
${this.instance?.icon
|
||||
? html`
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Currently set to:`} ${this.instance?.icon}
|
||||
${msg("Currently set to:")} ${this.instance?.icon}
|
||||
</p>
|
||||
`
|
||||
: html``}
|
||||
@ -191,29 +191,33 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label"> ${t`Clear icon`} </span>
|
||||
<span class="pf-c-switch__label">
|
||||
${msg("Clear icon")}
|
||||
</span>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Delete currently set icon.`}
|
||||
${msg("Delete currently set icon.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
`
|
||||
: html``}`
|
||||
: html`<ak-form-element-horizontal label=${t`Icon`} name="icon">
|
||||
: html`<ak-form-element-horizontal label=${msg("Icon")} name="icon">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(this.instance?.icon, "")}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Either input a full URL, a relative path, or use 'fa://fa-test' to use the Font Awesome icon "fa-test".`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${iconHelperText}</p>
|
||||
</ak-form-element-horizontal>`}
|
||||
|
||||
<ak-form-group .expanded=${true}>
|
||||
<span slot="header"> ${t`Protocol settings`} </span>
|
||||
<span slot="header"> ${msg("Protocol settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal label=${t`SSO URL`} ?required=${true} name="ssoUrl">
|
||||
<ak-form-element-horizontal
|
||||
label=${msg("SSO URL")}
|
||||
?required=${true}
|
||||
name="ssoUrl"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.ssoUrl)}"
|
||||
@ -221,48 +225,50 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`URL that the initial Login request is sent to.`}
|
||||
${msg("URL that the initial Login request is sent to.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`SLO URL`} name="sloUrl">
|
||||
<ak-form-element-horizontal label=${msg("SLO URL")} name="sloUrl">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.sloUrl || "")}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Optional URL if the IDP supports Single-Logout.`}
|
||||
${msg("Optional URL if the IDP supports Single-Logout.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Issuer`} name="issuer">
|
||||
<ak-form-element-horizontal label=${msg("Issuer")} name="issuer">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.issuer)}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Also known as Entity ID. Defaults the Metadata URL.`}
|
||||
${msg("Also known as Entity ID. Defaults the Metadata URL.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Binding Type`}
|
||||
label=${msg("Binding Type")}
|
||||
?required=${true}
|
||||
name="bindingType"
|
||||
>
|
||||
<ak-radio
|
||||
.options=${[
|
||||
{
|
||||
label: t`Redirect binding`,
|
||||
label: msg("Redirect binding"),
|
||||
value: BindingTypeEnum.Redirect,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
label: t`Post-auto binding`,
|
||||
label: msg("Post-auto binding"),
|
||||
value: BindingTypeEnum.PostAuto,
|
||||
description: html`${t`Post binding but the request is automatically sent and the user doesn't have to confirm.`}`,
|
||||
description: html`${msg(
|
||||
"Post binding but the request is automatically sent and the user doesn't have to confirm.",
|
||||
)}`,
|
||||
},
|
||||
{
|
||||
label: t`Post binding`,
|
||||
label: msg("Post binding"),
|
||||
value: BindingTypeEnum.Post,
|
||||
},
|
||||
]}
|
||||
@ -270,7 +276,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
>
|
||||
</ak-radio>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Signing keypair`} name="signingKp">
|
||||
<ak-form-element-horizontal label=${msg("Signing keypair")} name="signingKp">
|
||||
<ak-search-select
|
||||
.fetchObjects=${async (
|
||||
query?: string,
|
||||
@ -301,11 +307,13 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Keypair which is used to sign outgoing requests. Leave empty to disable signing.`}
|
||||
${msg(
|
||||
"Keypair which is used to sign outgoing requests. Leave empty to disable signing.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Verification Certificate`}
|
||||
label=${msg("Verification Certificate")}
|
||||
name="verificationKp"
|
||||
>
|
||||
<ak-search-select
|
||||
@ -337,13 +345,15 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`When selected, incoming assertion's Signatures will be validated against this certificate. To allow unsigned Requests, leave on default.`}
|
||||
${msg(
|
||||
"When selected, incoming assertion's Signatures will be validated against this certificate. To allow unsigned Requests, leave on default.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
</ak-form-group>
|
||||
<ak-form-group>
|
||||
<span slot="header"> ${t`Advanced protocol settings`} </span>
|
||||
<span slot="header"> ${msg("Advanced protocol settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal name="allowIdpInitiated">
|
||||
<label class="pf-c-switch">
|
||||
@ -358,15 +368,17 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label"
|
||||
>${t` Allow IDP-initiated logins`}</span
|
||||
>${msg(" Allow IDP-initiated logins")}</span
|
||||
>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Allows authentication flows initiated by the IdP. This can be a security risk, as no validation of the request ID is done.`}
|
||||
${msg(
|
||||
"Allows authentication flows initiated by the IdP. This can be a security risk, as no validation of the request ID is done.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`NameID Policy`}
|
||||
label=${msg("NameID Policy")}
|
||||
?required=${true}
|
||||
name="nameIdPolicy"
|
||||
>
|
||||
@ -376,39 +388,39 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
?selected=${this.instance?.nameIdPolicy ===
|
||||
NameIdPolicyEnum._20nameidFormatpersistent}
|
||||
>
|
||||
${t`Persistent`}
|
||||
${msg("Persistent")}
|
||||
</option>
|
||||
<option
|
||||
value=${NameIdPolicyEnum._11nameidFormatemailAddress}
|
||||
?selected=${this.instance?.nameIdPolicy ===
|
||||
NameIdPolicyEnum._11nameidFormatemailAddress}
|
||||
>
|
||||
${t`Email address`}
|
||||
${msg("Email address")}
|
||||
</option>
|
||||
<option
|
||||
value=${NameIdPolicyEnum._20nameidFormatWindowsDomainQualifiedName}
|
||||
?selected=${this.instance?.nameIdPolicy ===
|
||||
NameIdPolicyEnum._20nameidFormatWindowsDomainQualifiedName}
|
||||
>
|
||||
${t`Windows`}
|
||||
${msg("Windows")}
|
||||
</option>
|
||||
<option
|
||||
value=${NameIdPolicyEnum._20nameidFormatX509SubjectName}
|
||||
?selected=${this.instance?.nameIdPolicy ===
|
||||
NameIdPolicyEnum._20nameidFormatX509SubjectName}
|
||||
>
|
||||
${t`X509 Subject`}
|
||||
${msg("X509 Subject")}
|
||||
</option>
|
||||
<option
|
||||
value=${NameIdPolicyEnum._20nameidFormattransient}
|
||||
?selected=${this.instance?.nameIdPolicy ===
|
||||
NameIdPolicyEnum._20nameidFormattransient}
|
||||
>
|
||||
${t`Transient`}
|
||||
${msg("Transient")}
|
||||
</option>
|
||||
</select>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`User path`} name="userPathTemplate">
|
||||
<ak-form-element-horizontal label=${msg("User path")} name="userPathTemplate">
|
||||
<input
|
||||
type="text"
|
||||
value="${first(
|
||||
@ -417,12 +429,10 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
)}"
|
||||
class="pf-c-form-control"
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Path template for users created. Use placeholders like \`%(slug)s\` to insert the source slug.`}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">${placeholderHelperText}</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Delete temporary users after`}
|
||||
label=${msg("Delete temporary users after")}
|
||||
?required=${true}
|
||||
name="temporaryUserDeleteAfter"
|
||||
>
|
||||
@ -433,12 +443,14 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
required
|
||||
/>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually.`}
|
||||
${msg(
|
||||
"Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually.",
|
||||
)}
|
||||
</p>
|
||||
<ak-utils-time-delta-help></ak-utils-time-delta-help>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Digest algorithm`}
|
||||
label=${msg("Digest algorithm")}
|
||||
?required=${true}
|
||||
name="digestAlgorithm"
|
||||
>
|
||||
@ -467,7 +479,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
</ak-radio>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Signature algorithm`}
|
||||
label=${msg("Signature algorithm")}
|
||||
?required=${true}
|
||||
name="signatureAlgorithm"
|
||||
>
|
||||
@ -502,10 +514,10 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
</div>
|
||||
</ak-form-group>
|
||||
<ak-form-group>
|
||||
<span slot="header"> ${t`Flow settings`} </span>
|
||||
<span slot="header"> ${msg("Flow settings")} </span>
|
||||
<div slot="body" class="pf-c-form">
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Pre-authentication flow`}
|
||||
label=${msg("Pre-authentication flow")}
|
||||
?required=${true}
|
||||
name="preAuthenticationFlow"
|
||||
>
|
||||
@ -547,10 +559,12 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
?blankable=${true}
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">${t`Flow used before authentication.`}</p>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${msg("Flow used before authentication.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Authentication flow`}
|
||||
label=${msg("Authentication flow")}
|
||||
?required=${true}
|
||||
name="authenticationFlow"
|
||||
>
|
||||
@ -592,11 +606,11 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Flow to use when authenticating existing users.`}
|
||||
${msg("Flow to use when authenticating existing users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Enrollment flow`}
|
||||
label=${msg("Enrollment flow")}
|
||||
?required=${true}
|
||||
name="enrollmentFlow"
|
||||
>
|
||||
@ -638,7 +652,7 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Flow to use when enrolling new users.`}
|
||||
${msg("Flow to use when enrolling new users.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
|
||||
@ -9,8 +9,7 @@ import "@goauthentik/elements/buttons/SpinnerButton";
|
||||
import "@goauthentik/elements/events/ObjectChangelog";
|
||||
import "@goauthentik/elements/forms/ModalForm";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -63,7 +62,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
return html`<ak-tabs>
|
||||
<section
|
||||
slot="page-overview"
|
||||
data-tab-title="${t`Overview`}"
|
||||
data-tab-title="${msg("Overview")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
@ -72,7 +71,9 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
<dl class="pf-c-description-list pf-m-3-col-on-lg">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Name`}</span>
|
||||
<span class="pf-c-description-list__text"
|
||||
>${msg("Name")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -83,7 +84,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`SSO URL`}</span
|
||||
>${msg("SSO URL")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -95,7 +96,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`SLO URL`}</span
|
||||
>${msg("SLO URL")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -107,7 +108,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Issuer`}</span
|
||||
>${msg("Issuer")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -120,12 +121,12 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update SAML Source`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg("Update SAML Source")} </span>
|
||||
<ak-source-saml-form slot="form" .instancePk=${this.source.slug}>
|
||||
</ak-source-saml-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">
|
||||
${t`Edit`}
|
||||
${msg("Edit")}
|
||||
</button>
|
||||
</ak-forms-modal>
|
||||
</div>
|
||||
@ -134,7 +135,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<section
|
||||
slot="page-changelog"
|
||||
data-tab-title="${t`Changelog`}"
|
||||
data-tab-title="${msg("Changelog")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
@ -152,7 +153,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<section
|
||||
slot="page-metadata"
|
||||
data-tab-title="${t`Metadata`}"
|
||||
data-tab-title="${msg("Metadata")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
@activate=${() => {
|
||||
new SourcesApi(DEFAULT_CONFIG)
|
||||
@ -179,7 +180,7 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
target="_blank"
|
||||
href=${ifDefined(this.metadata?.downloadUrl)}
|
||||
>
|
||||
${t`Download`}
|
||||
${msg("Download")}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -187,14 +188,16 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
</section>
|
||||
<div
|
||||
slot="page-policy-bindings"
|
||||
data-tab-title="${t`Policy Bindings`}"
|
||||
data-tab-title="${msg("Policy Bindings")}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
<div class="pf-c-card__title">
|
||||
${t`These bindings control which users can access this source.
|
||||
You can only use policies here as access is checked before the user is authenticated.`}
|
||||
${msg(
|
||||
`These bindings control which users can access this source.
|
||||
You can only use policies here as access is checked before the user is authenticated.`,
|
||||
)}
|
||||
</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ak-bound-policies-list .target=${this.source.pk} ?policyOnly=${true}>
|
||||
|
||||
Reference in New Issue
Block a user