web: initial migration to lingui

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-04-03 19:26:43 +02:00
parent fc1caf1469
commit 25300c1928
150 changed files with 8720 additions and 1482 deletions

View File

@ -1,4 +1,4 @@
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../../elements/table/Table";
@ -36,22 +36,22 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
columns(): TableColumn[] {
return [
new TableColumn("Policy / User / Group"),
new TableColumn("Enabled", "enabled"),
new TableColumn("Order", "order"),
new TableColumn("Timeout", "timeout"),
new TableColumn(t`Enabled`, t`enabled`),
new TableColumn(t`Order`, t`order`),
new TableColumn(t`Timeout`, t`timeout`),
new TableColumn(""),
];
}
getPolicyUserGroupRow(item: PolicyBinding): string {
if (item.policy) {
return gettext(`Policy ${item.policyObj?.name}`);
return t`Policy ${item.policyObj?.name}`;
} else if (item.group) {
return gettext(`Group ${item.groupObj?.name}`);
return t`Group ${item.groupObj?.name}`;
} else if (item.user) {
return gettext(`User ${item.userObj?.name}`);
return t`User ${item.userObj?.name}`;
} else {
return gettext("");
return t`-`;
}
}
@ -60,10 +60,10 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
return html`
<ak-forms-modal>
<span slot="submit">
${gettext("Update")}
${t`Update`}
</span>
<span slot="header">
${gettext(`Update ${item.policyObj?.name}`)}
${t`Update ${item.policyObj?.name}`}
</span>
<ak-proxy-form
slot="form"
@ -73,35 +73,35 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
type=${ifDefined(item.policyObj?.component)}>
</ak-proxy-form>
<button slot="trigger" class="pf-c-button pf-m-secondary">
${gettext("Edit")}
${t`Edit`}
</button>
</ak-forms-modal>`;
} else if (item.group) {
return html`<ak-forms-modal>
<span slot="submit">
${gettext("Update")}
${t`Update`}
</span>
<span slot="header">
${gettext("Update Group")}
${t`Update Group`}
</span>
<ak-group-form slot="form" .group=${item.groupObj}>
</ak-group-form>
<button slot="trigger" class="pf-c-button pf-m-primary">
${gettext("Edit Group")}
${t`Edit Group`}
</button>
</ak-forms-modal>`;
} else if (item.user) {
return html`<ak-forms-modal>
<span slot="submit">
${gettext("Update")}
${t`Update`}
</span>
<span slot="header">
${gettext("Update User")}
${t`Update User`}
</span>
<ak-user-form slot="form" .user=${item.userObj}>
</ak-user-form>
<button slot="trigger" class="pf-m-secondary pf-c-button">
${gettext("Edit")}
${t`Edit`}
</button>
</ak-forms-modal>`;
} else {
@ -119,49 +119,49 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
${this.getObjectEditButton(item)}
<ak-forms-modal>
<span slot="submit">
${gettext("Update")}
${t`Update`}
</span>
<span slot="header">
${gettext("Update Binding")}
${t`Update Binding`}
</span>
<ak-policy-binding-form slot="form" .binding=${item} targetPk=${ifDefined(this.target)}>
</ak-policy-binding-form>
<button slot="trigger" class="pf-c-button pf-m-secondary">
${gettext("Edit Binding")}
${t`Edit Binding`}
</button>
</ak-forms-modal>
<ak-forms-delete
.obj=${item}
objectLabel=${gettext("Policy binding")}
objectLabel=${t`Policy binding`}
.delete=${() => {
return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsDelete({
policyBindingUuid: item.pk || "",
});
}}>
<button slot="trigger" class="pf-c-button pf-m-danger">
${gettext("Delete Binding")}
${t`Delete Binding`}
</button>
</ak-forms-delete>`,
];
}
renderEmpty(): TemplateResult {
return super.renderEmpty(html`<ak-empty-state header=${gettext("No Policies bound.")} icon="pf-icon-module">
return super.renderEmpty(html`<ak-empty-state header=${t`No Policies bound.`} icon="pf-icon-module">
<div slot="body">
${gettext("No policies are currently bound to this object.")}
${t`No policies are currently bound to this object.`}
</div>
<div slot="primary">
<ak-forms-modal>
<span slot="submit">
${gettext("Create")}
${t`Create`}
</span>
<span slot="header">
${gettext("Create Binding")}
${t`Create Binding`}
</span>
<ak-policy-binding-form slot="form" targetPk=${ifDefined(this.target)}>
</ak-policy-binding-form>
<button slot="trigger" class="pf-c-button pf-m-primary">
${gettext("Create Binding")}
${t`Create Binding`}
</button>
</ak-forms-modal>
</div>
@ -172,7 +172,7 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
return html`
<ak-dropdown class="pf-c-dropdown">
<button class="pf-m-primary pf-c-dropdown__toggle" type="button">
<span class="pf-c-dropdown__toggle-text">${gettext("Create Policy")}</span>
<span class="pf-c-dropdown__toggle-text">${t`Create Policy`}</span>
<i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</button>
<ul class="pf-c-dropdown__menu" hidden>
@ -181,10 +181,10 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
return html`<li>
<ak-forms-modal>
<span slot="submit">
${gettext("Create")}
${t`Create`}
</span>
<span slot="header">
${gettext(`Create ${type.name}`)}
${t`Create ${type.name}`}
</span>
<ak-proxy-form
slot="form"
@ -202,15 +202,15 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
</ak-dropdown>
<ak-forms-modal>
<span slot="submit">
${gettext("Create")}
${t`Create`}
</span>
<span slot="header">
${gettext("Create Binding")}
${t`Create Binding`}
</span>
<ak-policy-binding-form slot="form" targetPk=${ifDefined(this.target)}>
</ak-policy-binding-form>
<button slot="trigger" class="pf-c-button pf-m-primary">
${gettext("Create Binding")}
${t`Create Binding`}
</button>
</ak-forms-modal>
${super.renderToolbar()}

View File

@ -1,5 +1,5 @@
import { CoreApi, PoliciesApi, Policy, PolicyBinding } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../api/Config";
@ -20,9 +20,9 @@ export class PolicyBindingForm extends Form<PolicyBinding> {
getSuccessMessage(): string {
if (this.binding) {
return gettext("Successfully updated binding.");
return t`Successfully updated binding.`;
} else {
return gettext("Successfully created binding.");
return t`Successfully created binding.`;
}
}
@ -72,7 +72,7 @@ export class PolicyBindingForm extends Form<PolicyBinding> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Policy")}
label=${t`Policy`}
name="policy">
<select class="pf-c-form-control">
<option value="" ?selected=${this.binding?.policy === undefined}>---------</option>
@ -84,7 +84,7 @@ export class PolicyBindingForm extends Form<PolicyBinding> {
</select>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Group")}
label=${t`Group`}
name="group">
<select class="pf-c-form-control">
<option value="" ?selected=${this.binding?.group === undefined}>---------</option>
@ -98,7 +98,7 @@ export class PolicyBindingForm extends Form<PolicyBinding> {
</select>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("User")}
label=${t`User`}
name="user">
<select class="pf-c-form-control">
<option value="" ?selected=${this.binding?.user === undefined}>---------</option>
@ -116,18 +116,18 @@ export class PolicyBindingForm extends Form<PolicyBinding> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.binding?.enabled || true}>
<label class="pf-c-check__label">
${gettext("Enabled")}
${t`Enabled`}
</label>
</div>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Order")}
label=${t`Order`}
?required=${true}
name="order">
<input type="number" value="${until(this.getOrder(), this.binding?.order)}" class="pf-c-form-control" required>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Timeout")}
label=${t`Timeout`}
?required=${true}
name="timeout">
<input type="number" value="${first(this.binding?.timeout, 30)}" class="pf-c-form-control" required>

View File

@ -1,4 +1,4 @@
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage";
@ -29,10 +29,10 @@ export class PolicyListPage extends TablePage<Policy> {
return true;
}
pageTitle(): string {
return gettext("Policies");
return t`Policies`;
}
pageDescription(): string {
return gettext("Allow users to use Applications based on properties, enforce Password Criteria and selectively apply Stages.");
return t`Allow users to use Applications based on properties, enforce Password Criteria and selectively apply Stages.`;
}
pageIcon(): string {
return "pf-icon pf-icon-infrastructure";
@ -52,7 +52,7 @@ export class PolicyListPage extends TablePage<Policy> {
columns(): TableColumn[] {
return [
new TableColumn("Name", "name"),
new TableColumn(t`Name`, t`name`),
new TableColumn("Type"),
new TableColumn(""),
];
@ -65,19 +65,19 @@ export class PolicyListPage extends TablePage<Policy> {
${(item.boundTo || 0) > 0 ?
html`<i class="pf-icon pf-icon-ok"></i>
<small>
${gettext(`Assigned to ${item.boundTo} objects.`)}
${t`Assigned to ${item.boundTo} objects.`}
</small>`:
html`<i class="pf-icon pf-icon-warning-triangle"></i>
<small>${gettext("Warning: Policy is not assigned.")}</small>`}
<small>${t`Warning: Policy is not assigned.`}</small>`}
</div>`,
html`${item.verboseName}`,
html`
<ak-forms-modal>
<span slot="submit">
${gettext("Update")}
${t`Update`}
</span>
<span slot="header">
${gettext(`Update ${item.verboseName}`)}
${t`Update ${item.verboseName}`}
</span>
<ak-proxy-form
slot="form"
@ -87,32 +87,32 @@ export class PolicyListPage extends TablePage<Policy> {
type=${ifDefined(item.component)}>
</ak-proxy-form>
<button slot="trigger" class="pf-c-button pf-m-secondary">
${gettext("Edit")}
${t`Edit`}
</button>
</ak-forms-modal>
<ak-forms-modal .closeAfterSuccessfulSubmit=${false}>
<span slot="submit">
${gettext("Test")}
${t`Test`}
</span>
<span slot="header">
${gettext("Test Policy")}
${t`Test Policy`}
</span>
<ak-policy-test-form slot="form" .policy=${item}>
</ak-policy-test-form>
<button slot="trigger" class="pf-c-button pf-m-secondary">
${gettext("Test")}
${t`Test`}
</button>
</ak-forms-modal>
<ak-forms-delete
.obj=${item}
objectLabel=${gettext("Policy")}
objectLabel=${t`Policy`}
.delete=${() => {
return new PoliciesApi(DEFAULT_CONFIG).policiesAllDelete({
policyUuid: item.pk || ""
});
}}>
<button slot="trigger" class="pf-c-button pf-m-danger">
${gettext("Delete")}
${t`Delete`}
</button>
</ak-forms-delete>`,
];
@ -122,7 +122,7 @@ export class PolicyListPage extends TablePage<Policy> {
return html`
<ak-dropdown class="pf-c-dropdown">
<button class="pf-m-primary pf-c-dropdown__toggle" type="button">
<span class="pf-c-dropdown__toggle-text">${gettext("Create")}</span>
<span class="pf-c-dropdown__toggle-text">${t`Create`}</span>
<i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</button>
<ul class="pf-c-dropdown__menu" hidden>
@ -131,10 +131,10 @@ export class PolicyListPage extends TablePage<Policy> {
return html`<li>
<ak-forms-modal>
<span slot="submit">
${gettext("Create")}
${t`Create`}
</span>
<span slot="header">
${gettext(`Create ${type.name}`)}
${t`Create ${type.name}`}
</span>
<ak-proxy-form
slot="form"

View File

@ -1,5 +1,5 @@
import { CoreApi, PoliciesApi, Policy, PolicyTestResult } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../api/Config";
@ -20,7 +20,7 @@ export class PolicyTestForm extends Form<PolicyTest> {
result?: PolicyTestResult;
getSuccessMessage(): string {
return gettext("Successfully sent test-request.");
return t`Successfully sent test-request.`;
}
send = (data: PolicyTest): Promise<PolicyTestResult> => {
@ -33,15 +33,15 @@ export class PolicyTestForm extends Form<PolicyTest> {
renderResult(): TemplateResult {
return html`
<ak-form-element-horizontal
label=${gettext("Passing")}>
label=${t`Passing`}>
<div class="pf-c-form__group-label">
<div class="c-form__horizontal-group">
<span class="pf-c-form__label-text">${this.result?.passing ? gettext("Yes") : gettext("No")}</span>
<span class="pf-c-form__label-text">${this.result?.passing ? t`Yes` : t`No`}</span>
</div>
</div>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Messages")}>
label=${t`Messages`}>
<div class="pf-c-form__group-label">
<div class="c-form__horizontal-group">
<ul>
@ -59,7 +59,7 @@ export class PolicyTestForm extends Form<PolicyTest> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("User")}
label=${t`User`}
?required=${true}
name="user">
<select class="pf-c-form-control">
@ -73,7 +73,7 @@ export class PolicyTestForm extends Form<PolicyTest> {
</select>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Context")}
label=${t`Context`}
name="context">
<ak-codemirror mode="yaml">
</ak-codemirror>

View File

@ -1,5 +1,5 @@
import { DummyPolicy, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -25,9 +25,9 @@ export class DummyPolicyForm extends Form<DummyPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -47,7 +47,7 @@ export class DummyPolicyForm extends Form<DummyPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -56,34 +56,34 @@ export class DummyPolicyForm extends Form<DummyPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal name="result">
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.result || false}>
<label class="pf-c-check__label">
${gettext("Pass policy?")}
${t`Pass policy?`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Wait (min)")}
label=${t`Wait (min)`}
?required=${true}
name="waitMin">
<input type="number" value="${first(this.policy?.waitMin, 1)}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${gettext("The policy takes a random time to execute. This controls the minimum time it will take.")}</p>
<p class="pf-c-form__helper-text">${t`The policy takes a random time to execute. This controls the minimum time it will take.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Wait (max)")}
label=${t`Wait (max)`}
?required=${true}
name="waitMax">
<input type="number" value="${first(this.policy?.waitMax, 5)}" class="pf-c-form-control" required>

View File

@ -1,5 +1,5 @@
import { AdminApi, EventMatcherPolicy, EventsApi, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -25,9 +25,9 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -47,7 +47,7 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -56,18 +56,18 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Action")}
label=${t`Action`}
name="action">
<select class="pf-c-form-control">
<option value="" ?selected=${this.policy?.action === undefined}>---------</option>
@ -77,16 +77,16 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
});
}))}
</select>
<p class="pf-c-form__helper-text">${gettext("Match created events with this action type. When left empty, all action types will be matched.")}</p>
<p class="pf-c-form__helper-text">${t`Match created events with this action type. When left empty, all action types will be matched.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Client IP")}
label=${t`Client IP`}
name="clientIp">
<input type="text" value="${ifDefined(this.policy?.clientIp || "")}" class="pf-c-form-control">
<p class="pf-c-form__helper-text">${gettext("Matches Event's Client IP (strict matching, for network matching use an Expression Policy.")}</p>
<p class="pf-c-form__helper-text">${t`Matches Event's Client IP (strict matching, for network matching use an Expression Policy.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("App")}
label=${t`App`}
name="app">
<select class="pf-c-form-control">
<option value="" ?selected=${this.policy?.app === undefined}>---------</option>
@ -96,7 +96,7 @@ export class EventMatcherPolicyForm extends Form<EventMatcherPolicy> {
});
}))}
</select>
<p class="pf-c-form__helper-text">${gettext("Match events created by selected application. When left empty, all applications are matched.")}</p>
<p class="pf-c-form__helper-text">${t`Match events created by selected application. When left empty, all applications are matched.`}</p>
</ak-form-element-horizontal>
</div>
</ak-form-group>

View File

@ -1,5 +1,5 @@
import { PasswordExpiryPolicy, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -24,9 +24,9 @@ export class PasswordExpiryPolicyForm extends Form<PasswordExpiryPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -46,7 +46,7 @@ export class PasswordExpiryPolicyForm extends Form<PasswordExpiryPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -55,18 +55,18 @@ export class PasswordExpiryPolicyForm extends Form<PasswordExpiryPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Maximum age (in days)")}
label=${t`Maximum age (in days)`}
?required=${true}
name="days">
<input type="number" value="${ifDefined(this.policy?.days || "")}" class="pf-c-form-control" required>
@ -75,7 +75,7 @@ export class PasswordExpiryPolicyForm extends Form<PasswordExpiryPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.denyOnly || false}>
<label class="pf-c-check__label">
${gettext("Only fail the policy, don't set user's password.")}
${t`Only fail the policy, don't set user's password.`}
</label>
</div>
</ak-form-element-horizontal>

View File

@ -1,5 +1,5 @@
import { ExpressionPolicy, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -25,9 +25,9 @@ export class ExpressionPolicyForm extends Form<ExpressionPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -47,7 +47,7 @@ export class ExpressionPolicyForm extends Form<ExpressionPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -56,18 +56,18 @@ export class ExpressionPolicyForm extends Form<ExpressionPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Expression")}
label=${t`Expression`}
name="expression">
<ak-codemirror mode="python" value="${ifDefined(this.policy?.expression)}">
</ak-codemirror>

View File

@ -1,5 +1,5 @@
import { HaveIBeenPwendPolicy, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -25,9 +25,9 @@ export class HaveIBeenPwnedPolicyForm extends Form<HaveIBeenPwendPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -47,7 +47,7 @@ export class HaveIBeenPwnedPolicyForm extends Form<HaveIBeenPwendPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -56,29 +56,29 @@ export class HaveIBeenPwnedPolicyForm extends Form<HaveIBeenPwendPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Password field")}
label=${t`Password field`}
?required=${true}
name="passwordField">
<input type="text" value="${ifDefined(this.policy?.passwordField || "password")}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${gettext("Field key to check, field keys defined in Prompt stages are available.")}</p>
<p class="pf-c-form__helper-text">${t`Field key to check, field keys defined in Prompt stages are available.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Allowed count")}
label=${t`Allowed count`}
?required=${true}
name="allowedCount">
<input type="number" value="${first(this.policy?.allowedCount, 0)}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${gettext("Allow up to N occurrences in the HIBP database.")}</p>
<p class="pf-c-form__helper-text">${t`Allow up to N occurrences in the HIBP database.`}</p>
</ak-form-element-horizontal>
</div>
</ak-form-group>

View File

@ -1,5 +1,5 @@
import { PasswordPolicy, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -25,9 +25,9 @@ export class PasswordPolicyForm extends Form<PasswordPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -47,7 +47,7 @@ export class PasswordPolicyForm extends Form<PasswordPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -56,50 +56,50 @@ export class PasswordPolicyForm extends Form<PasswordPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Password field")}
label=${t`Password field`}
?required=${true}
name="passwordField">
<input type="text" value="${ifDefined(this.policy?.passwordField || "password")}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${gettext("Field key to check, field keys defined in Prompt stages are available.")}</p>
<p class="pf-c-form__helper-text">${t`Field key to check, field keys defined in Prompt stages are available.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Minimum length")}
label=${t`Minimum length`}
?required=${true}
name="lengthMin">
<input type="number" value="${first(this.policy?.lengthMin, 10)}" class="pf-c-form-control" required>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Minimum amount of Uppercase Characters")}
label=${t`Minimum amount of Uppercase Characters`}
?required=${true}
name="amountUppercase">
<input type="number" value="${first(this.policy?.amountUppercase, 2)}" class="pf-c-form-control" required>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Minimum amount of Lowercase Characters")}
label=${t`Minimum amount of Lowercase Characters`}
?required=${true}
name="amountLowercase">
<input type="number" value="${first(this.policy?.amountLowercase, 2)}" class="pf-c-form-control" required>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Minimum amount of Symbols Characters")}
label=${t`Minimum amount of Symbols Characters`}
?required=${true}
name="amountSymbols">
<input type="number" value="${first(this.policy?.amountSymbols, 2)}" class="pf-c-form-control" required>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Error message")}
label=${t`Error message`}
?required=${true}
name="errorMessage">
<input type="text" value="${ifDefined(this.policy?.errorMessage)}" class="pf-c-form-control" required>
@ -108,15 +108,15 @@ export class PasswordPolicyForm extends Form<PasswordPolicy> {
</ak-form-group>
<ak-form-group>
<span slot="header">
${gettext("Advanced settings")}
${t`Advanced settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${gettext("Symbol charset")}
label=${t`Symbol charset`}
?required=${true}
name="symbolCharset">
<input type="text" value="${ifDefined(this.policy?.symbolCharset || "!\\\"#$%&'()*+,-./:;<=>?@[]^_`{|}~ ")}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${gettext("Characters which are considered as symbols.")}</p>
<p class="pf-c-form__helper-text">${t`Characters which are considered as symbols.`}</p>
</ak-form-element-horizontal>
</div>
</ak-form-group>

View File

@ -1,5 +1,5 @@
import { ReputationPolicy, PoliciesApi } from "authentik-api";
import { gettext } from "django";
import { t } from "@lingui/macro";
import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html";
import { DEFAULT_CONFIG } from "../../../api/Config";
@ -24,9 +24,9 @@ export class ReputationPolicyForm extends Form<ReputationPolicy> {
getSuccessMessage(): string {
if (this.policy) {
return gettext("Successfully updated policy.");
return t`Successfully updated policy.`;
} else {
return gettext("Successfully created policy.");
return t`Successfully created policy.`;
}
}
@ -46,7 +46,7 @@ export class ReputationPolicyForm extends Form<ReputationPolicy> {
renderForm(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal
label=${gettext("Name")}
label=${t`Name`}
?required=${true}
name="name">
<input type="text" value="${ifDefined(this.policy?.name || "")}" class="pf-c-form-control" required>
@ -55,21 +55,21 @@ export class ReputationPolicyForm extends Form<ReputationPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.executionLogging || false}>
<label class="pf-c-check__label">
${gettext("Execution logging")}
${t`Execution logging`}
</label>
</div>
<p class="pf-c-form__helper-text">${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}</p>
<p class="pf-c-form__helper-text">${t`When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.`}</p>
</ak-form-element-horizontal>
<ak-form-group .expanded=${true}>
<span slot="header">
${gettext("Policy-specific settings")}
${t`Policy-specific settings`}
</span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal name="checkIp">
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.checkIp || false}>
<label class="pf-c-check__label">
${gettext("Check IP")}
${t`Check IP`}
</label>
</div>
</ak-form-element-horizontal>
@ -77,12 +77,12 @@ export class ReputationPolicyForm extends Form<ReputationPolicy> {
<div class="pf-c-check">
<input type="checkbox" class="pf-c-check__input" ?checked=${this.policy?.checkUsername || false}>
<label class="pf-c-check__label">
${gettext("Check Username")}
${t`Check Username`}
</label>
</div>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${gettext("Threshold")}
label=${t`Threshold`}
?required=${true}
name="threshold">
<input type="number" value="${ifDefined(this.policy?.threshold || -5)}" class="pf-c-form-control" required>