web: only show debug locale if debug mode is enabled (#5111)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
1d2725825c
commit
2084156f1d
|
@ -1,4 +1,5 @@
|
||||||
import { LOCALES } from "@goauthentik/common/ui/locale";
|
import { LOCALES } from "@goauthentik/common/ui/locale";
|
||||||
|
import { rootInterface } from "@goauthentik/elements/Base";
|
||||||
import "@goauthentik/elements/Divider";
|
import "@goauthentik/elements/Divider";
|
||||||
import "@goauthentik/elements/EmptyState";
|
import "@goauthentik/elements/EmptyState";
|
||||||
import "@goauthentik/elements/forms/FormElement";
|
import "@goauthentik/elements/forms/FormElement";
|
||||||
|
@ -19,6 +20,7 @@ import PFTitle from "@patternfly/patternfly/components/Title/title.css";
|
||||||
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
CapabilitiesEnum,
|
||||||
PromptChallenge,
|
PromptChallenge,
|
||||||
PromptChallengeResponseRequest,
|
PromptChallengeResponseRequest,
|
||||||
PromptTypeEnum,
|
PromptTypeEnum,
|
||||||
|
@ -181,14 +183,24 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
|
||||||
<option value="" ${prompt.placeholder === "" ? "selected" : ""}>
|
<option value="" ${prompt.placeholder === "" ? "selected" : ""}>
|
||||||
${t`Auto-detect (based on your browser)`}
|
${t`Auto-detect (based on your browser)`}
|
||||||
</option>
|
</option>
|
||||||
${LOCALES.map((locale) => {
|
${LOCALES.filter((locale) => {
|
||||||
|
// Only show debug locale if debug mode is enabled
|
||||||
|
if (locale.code === "debug") {
|
||||||
|
return rootInterface()?.config?.capabilities.includes(
|
||||||
|
CapabilitiesEnum.Debug,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.map((locale) => {
|
||||||
return `<option
|
return `<option
|
||||||
value=${locale.code}
|
value=${locale.code}
|
||||||
${prompt.placeholder === locale.code ? "selected" : ""}
|
${prompt.placeholder === locale.code ? "selected" : ""}
|
||||||
>
|
>
|
||||||
${locale.code.toUpperCase()} - ${locale.label}
|
${locale.code.toUpperCase()} - ${locale.label}
|
||||||
</option>`;
|
</option>`;
|
||||||
}).join("")}
|
})
|
||||||
|
.join("")}
|
||||||
</select>`;
|
</select>`;
|
||||||
default:
|
default:
|
||||||
return `<p>invalid type '${prompt.type}'</p>`;
|
return `<p>invalid type '${prompt.type}'</p>`;
|
||||||
|
|
Reference in New Issue