fix hydration issue for IDPs, i18n

This commit is contained in:
Max Peintner
2025-05-26 13:18:37 +02:00
parent 80f106dc65
commit c00bab46e0
10 changed files with 17 additions and 7 deletions

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "Mit SSO anmelden", "title": "Mit SSO anmelden",
"description": "Wählen Sie einen der folgenden Anbieter, um sich anzumelden", "description": "Wählen Sie einen der folgenden Anbieter, um sich anzumelden",
"orSignInWith": "oder melden Sie sich an mit",
"signInWithApple": "Mit Apple anmelden", "signInWithApple": "Mit Apple anmelden",
"signInWithGoogle": "Mit Google anmelden", "signInWithGoogle": "Mit Google anmelden",
"signInWithAzureAD": "Mit AzureAD anmelden", "signInWithAzureAD": "Mit AzureAD anmelden",

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "Sign in with SSO", "title": "Sign in with SSO",
"description": "Select one of the following providers to sign in", "description": "Select one of the following providers to sign in",
"orSignInWith": "or sign in with",
"signInWithApple": "Sign in with Apple", "signInWithApple": "Sign in with Apple",
"signInWithGoogle": "Sign in with Google", "signInWithGoogle": "Sign in with Google",
"signInWithAzureAD": "Sign in with AzureAD", "signInWithAzureAD": "Sign in with AzureAD",

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "Iniciar sesión con SSO", "title": "Iniciar sesión con SSO",
"description": "Selecciona uno de los siguientes proveedores para iniciar sesión", "description": "Selecciona uno de los siguientes proveedores para iniciar sesión",
"orSignInWith": "o iniciar sesión con",
"signInWithApple": "Iniciar sesión con Apple", "signInWithApple": "Iniciar sesión con Apple",
"signInWithGoogle": "Iniciar sesión con Google", "signInWithGoogle": "Iniciar sesión con Google",
"signInWithAzureAD": "Iniciar sesión con AzureAD", "signInWithAzureAD": "Iniciar sesión con AzureAD",

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "Accedi con SSO", "title": "Accedi con SSO",
"description": "Seleziona uno dei seguenti provider per accedere", "description": "Seleziona uno dei seguenti provider per accedere",
"orSignInWith": "o accedi con",
"signInWithApple": "Accedi con Apple", "signInWithApple": "Accedi con Apple",
"signInWithGoogle": "Accedi con Google", "signInWithGoogle": "Accedi con Google",
"signInWithAzureAD": "Accedi con AzureAD", "signInWithAzureAD": "Accedi con AzureAD",

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "Zaloguj się za pomocą SSO", "title": "Zaloguj się za pomocą SSO",
"description": "Wybierz jednego z poniższych dostawców, aby się zalogować", "description": "Wybierz jednego z poniższych dostawców, aby się zalogować",
"orSignInWith": "lub zaloguj się przez",
"signInWithApple": "Zaloguj się przez Apple", "signInWithApple": "Zaloguj się przez Apple",
"signInWithGoogle": "Zaloguj się przez Google", "signInWithGoogle": "Zaloguj się przez Google",
"signInWithAzureAD": "Zaloguj się przez AzureAD", "signInWithAzureAD": "Zaloguj się przez AzureAD",

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "Войти через SSO", "title": "Войти через SSO",
"description": "Выберите одного из провайдеров для входа", "description": "Выберите одного из провайдеров для входа",
"orSignInWith": "или войти через",
"signInWithApple": "Войти через Apple", "signInWithApple": "Войти через Apple",
"signInWithGoogle": "Войти через Google", "signInWithGoogle": "Войти через Google",
"signInWithAzureAD": "Войти через AzureAD", "signInWithAzureAD": "Войти через AzureAD",

View File

@@ -37,6 +37,7 @@
"idp": { "idp": {
"title": "使用 SSO 登录", "title": "使用 SSO 登录",
"description": "选择以下提供商中的一个进行登录", "description": "选择以下提供商中的一个进行登录",
"orSignInWith": "或使用以下方式登录",
"signInWithApple": "用 Apple 登录", "signInWithApple": "用 Apple 登录",
"signInWithGoogle": "用 Google 登录", "signInWithGoogle": "用 Google 登录",
"signInWithAzureAD": "用 AzureAD 登录", "signInWithAzureAD": "用 AzureAD 登录",

View File

@@ -74,15 +74,17 @@ export default async function Page(props: {
suffix={suffix} suffix={suffix}
submit={submit} submit={submit}
allowRegister={!!loginSettings?.allowRegister} allowRegister={!!loginSettings?.allowRegister}
> ></UsernameForm>
{identityProviders && (
{identityProviders && (
<div className="w-full pt-6 pb-4">
<SignInWithIdp <SignInWithIdp
identityProviders={identityProviders} identityProviders={identityProviders}
requestId={requestId} requestId={requestId}
organization={organization} organization={organization}
></SignInWithIdp> ></SignInWithIdp>
)} </div>
</UsernameForm> )}
</div> </div>
</DynamicTheme> </DynamicTheme>
); );

View File

@@ -6,6 +6,7 @@ import {
IdentityProvider, IdentityProvider,
IdentityProviderType, IdentityProviderType,
} from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { useTranslations } from "next-intl";
import { ReactNode, useActionState } from "react"; import { ReactNode, useActionState } from "react";
import { Alert } from "./alert"; import { Alert } from "./alert";
import { SignInWithIdentityProviderProps } from "./idps/base-button"; import { SignInWithIdentityProviderProps } from "./idps/base-button";
@@ -31,6 +32,7 @@ export function SignInWithIdp({
linkOnly, linkOnly,
}: Readonly<SignInWithIDPProps>) { }: Readonly<SignInWithIDPProps>) {
const [state, action, _isPending] = useActionState(redirectToIdp, {}); const [state, action, _isPending] = useActionState(redirectToIdp, {});
const t = useTranslations("idp");
const renderIDPButton = (idp: IdentityProvider, index: number) => { const renderIDPButton = (idp: IdentityProvider, index: number) => {
const { id, name, type } = idp; const { id, name, type } = idp;
@@ -53,6 +55,7 @@ export function SignInWithIdp({
[IdentityProviderType.GITLAB]: SignInWithGitlab, [IdentityProviderType.GITLAB]: SignInWithGitlab,
[IdentityProviderType.GITLAB_SELF_HOSTED]: SignInWithGitlab, [IdentityProviderType.GITLAB_SELF_HOSTED]: SignInWithGitlab,
[IdentityProviderType.SAML]: SignInWithGeneric, [IdentityProviderType.SAML]: SignInWithGeneric,
[IdentityProviderType.LDAP]: SignInWithGeneric,
}; };
const Component = components[type]; const Component = components[type];
@@ -74,6 +77,7 @@ export function SignInWithIdp({
return ( return (
<div className="flex flex-col w-full space-y-2 text-sm"> <div className="flex flex-col w-full space-y-2 text-sm">
<p className="text-center ztdl-p">{t("orSignInWith")}</p>
{!!identityProviders.length && identityProviders?.map(renderIDPButton)} {!!identityProviders.length && identityProviders?.map(renderIDPButton)}
{state?.error && ( {state?.error && (
<div className="py-4"> <div className="py-4">

View File

@@ -137,9 +137,6 @@ export function UsernameForm({
<Alert>{error}</Alert> <Alert>{error}</Alert>
</div> </div>
)} )}
<div className="pt-6 pb-4">{children}</div>
<div className="mt-4 flex w-full flex-row items-center"> <div className="mt-4 flex w-full flex-row items-center">
<BackButton data-testid="back-button" /> <BackButton data-testid="back-button" />
<span className="flex-grow"></span> <span className="flex-grow"></span>