missing i18n, cleanup

This commit is contained in:
Max Peintner
2025-06-25 08:14:04 +02:00
parent 5189b6ae47
commit bfb7928b6b
8 changed files with 55 additions and 23 deletions

View File

@@ -80,6 +80,13 @@
"description": "Bitte vervollständige die Registrierung, um dein Konto zu erstellen."
}
},
"ldap": {
"title": "LDAP Login",
"description": "Geben Sie Ihre LDAP-Anmeldedaten ein.",
"username": "Benutzername",
"password": "Passwort",
"submit": "Weiter"
},
"mfa": {
"verify": {
"title": "Bestätigen Sie Ihre Identität",

View File

@@ -80,6 +80,13 @@
"description": "Para completar el registro, debes establecer una contraseña."
}
},
"ldap": {
"title": "Iniciar sesión con LDAP",
"description": "Introduce tus credenciales LDAP.",
"username": "Nombre de usuario",
"password": "Contraseña",
"submit": "Continuar"
},
"mfa": {
"verify": {
"title": "Verifica tu identidad",

View File

@@ -80,6 +80,13 @@
"description": "Completa la registrazione del tuo account."
}
},
"ldap": {
"title": "Accedi con LDAP",
"description": "Inserisci le tue credenziali LDAP.",
"username": "Nome utente",
"password": "Password",
"submit": "Continua"
},
"mfa": {
"verify": {
"title": "Verifica la tua identità",

View File

@@ -80,6 +80,13 @@
"description": "Ukończ rejestrację swojego konta."
}
},
"ldap": {
"title": "Zaloguj się przez LDAP",
"description": "Wprowadź swoje dane logowania LDAP.",
"username": "Nazwa użytkownika",
"password": "Hasło",
"submit": "Kontynuuj"
},
"mfa": {
"verify": {
"title": "Zweryfikuj swoją tożsamość",

View File

@@ -80,6 +80,13 @@
"description": "Завершите регистрацию вашего аккаунта."
}
},
"ldap": {
"title": "Войти через LDAP",
"description": "Введите ваши учетные данные LDAP.",
"username": "Имя пользователя",
"password": "Пароль",
"submit": "Продолжить"
},
"mfa": {
"verify": {
"title": "Подтвердите вашу личность",

View File

@@ -80,6 +80,13 @@
"description": "完成您的账户注册。"
}
},
"ldap": {
"title": "使用 LDAP 登录",
"description": "请输入您的 LDAP 凭据。",
"username": "用户名",
"password": "密码",
"submit": "继续"
},
"mfa": {
"verify": {
"title": "验证您的身份",

View File

@@ -1,9 +1,9 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { LDAPUsernamePasswordForm } from "@/components/ldap-username-password-form";
import { Translated } from "@/components/translated";
import { getServiceUrlFromHeaders } from "@/lib/service-url";
import { getBrandingSettings, getDefaultOrg } from "@/lib/zitadel";
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
import { getLocale, getTranslations } from "next-intl/server";
import { headers } from "next/headers";
export default async function Page(props: {
@@ -11,9 +11,7 @@ export default async function Page(props: {
params: Promise<{ provider: string }>;
}) {
const searchParams = await props.searchParams;
const locale = getLocale();
const t = await getTranslations({ locale, namespace: "ldap" });
const { idpId, requestId, organization, link } = searchParams;
const { idpId, organization, link } = searchParams;
if (!idpId) {
throw new Error("No idpId provided in searchParams");
@@ -41,14 +39,14 @@ export default async function Page(props: {
return (
<DynamicTheme branding={branding}>
<div className="flex flex-col items-center space-y-4">
<h1>{t("title")}</h1>
<p className="ztdl-p">{t("description")}</p>
<h1>
<Translated i18nKey="title" namespace="ldap" />
</h1>
<p className="ztdl-p">
<Translated i18nKey="description" namespace="ldap" />
</p>
<LDAPUsernamePasswordForm
idpId={idpId}
requestId={requestId}
organization={organization} // stick to "organization" as we still want to do user discovery based on the searchParams not the default organization, later the organization is determined by the found user
></LDAPUsernamePasswordForm>
<LDAPUsernamePasswordForm idpId={idpId}></LDAPUsernamePasswordForm>
</div>
</DynamicTheme>
);

View File

@@ -1,7 +1,6 @@
"use client";
import { createNewSessionForLDAP } from "@/lib/server/idp";
import { useTranslations } from "next-intl";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { useForm } from "react-hook-form";
@@ -10,6 +9,7 @@ import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./button";
import { TextInput } from "./input";
import { Spinner } from "./spinner";
import { Translated } from "./translated";
type Inputs = {
loginName: string;
@@ -17,18 +17,10 @@ type Inputs = {
};
type Props = {
organization?: string;
requestId?: string;
idpId: string;
};
export function LDAPUsernamePasswordForm({
organization,
requestId,
idpId,
}: Props) {
const t = useTranslations("password");
export function LDAPUsernamePasswordForm({ idpId }: Props) {
const { register, handleSubmit, formState } = useForm<Inputs>({
mode: "onBlur",
});
@@ -72,7 +64,7 @@ export function LDAPUsernamePasswordForm({
type="text"
autoComplete="username"
{...register("loginName", { required: "This field is required" })}
label={"Loginname"}
label="Loginname"
data-testid="username-text-input"
/>
@@ -104,7 +96,7 @@ export function LDAPUsernamePasswordForm({
data-testid="submit-button"
>
{loading && <Spinner className="h-5 w-5 mr-2" />}
{t("verify.submit")}
<Translated i18nKey="verify.submit" namespace="ldap" />
</Button>
</div>
</form>