feat(login): translations (#10849)

# Which Problems Are Solved

Replace this example text with a concise list of problems that this PR
solves.
For example:
- password complexity requirements have hardcoded English text
- password, loginname, register and verify components have hardcoded
Engilsh error messages/alerts

# How the Problems Are Solved

Replace this example text with a concise list of changes that this PR
introduces.
For example:
- adds i18n for password complexity requirements
- adds i18n for password, loginname, register and verify components
error messages/alerts

# Additional Changes

- small change in code/styles for icons in PasswordComplexity to make
sure that icons keep size

# Additional Context

N.A

---------

Co-authored-by: Adam Kida <[email protected]>
This commit is contained in:
Max Peintner
2025-10-09 11:11:03 +02:00
committed by GitHub
co-authored by Adam Kida
parent 794054c075
commit 64e14de091
22 changed files with 972 additions and 195 deletions
+14 -9
View File
@@ -42,6 +42,11 @@ vi.mock("./host", () => ({
getOriginalHost: vi.fn(),
}));
// this returns the key itself that can be checked not the translated value
vi.mock("next-intl/server", () => ({
getTranslations: vi.fn(() => (key: string) => key),
}));
describe("sendLoginname", () => {
// Mock modules
let mockHeaders: any;
@@ -116,7 +121,7 @@ describe("sendLoginname", () => {
loginName: "[email protected]",
});
expect(result).toEqual({ error: "Could not get login settings" });
expect(result).toEqual({ error: "errors.couldNotGetLoginSettings" });
});
test("should return error when user search fails", async () => {
@@ -138,7 +143,7 @@ describe("sendLoginname", () => {
loginName: "[email protected]",
});
expect(result).toEqual({ error: "Could not search users" });
expect(result).toEqual({ error: "errors.couldNotSearchUsers" });
});
test("should return error when more than one user found", async () => {
@@ -154,7 +159,7 @@ describe("sendLoginname", () => {
loginName: "[email protected]",
});
expect(result).toEqual({ error: "More than one user found. Provide a unique identifier." });
expect(result).toEqual({ error: "errors.moreThanOneUserFound" });
});
});
@@ -250,7 +255,7 @@ describe("sendLoginname", () => {
});
expect(result).toEqual({
error: "Username Password not allowed! Contact your administrator for more information.",
error: "errors.usernamePasswordNotAllowed",
});
});
@@ -282,7 +287,7 @@ describe("sendLoginname", () => {
});
expect(result).toEqual({
error: "Passkeys not allowed! Contact your administrator for more information.",
error: "errors.passkeysNotAllowed",
});
});
@@ -374,7 +379,7 @@ describe("sendLoginname", () => {
});
expect(result).toEqual({
error: "Username Password not allowed! Contact your administrator for more information.",
error: "errors.usernamePasswordNotAllowed",
});
});
});
@@ -450,7 +455,7 @@ describe("sendLoginname", () => {
loginName: "[email protected]",
});
expect(result).toEqual({ error: "User not found in the system" });
expect(result).toEqual({ error: "errors.userNotFound" });
});
});
@@ -473,7 +478,7 @@ describe("sendLoginname", () => {
loginName: "[email protected]",
});
expect(result).toEqual({ error: "Could not create session for user" });
expect(result).toEqual({ error: "errors.couldNotCreateSession" });
});
test("should handle initial user state", async () => {
@@ -504,7 +509,7 @@ describe("sendLoginname", () => {
loginName: "[email protected]",
});
expect(result).toEqual({ error: "Initial User not supported" });
expect(result).toEqual({ error: "errors.initialUserNotSupported" });
});
test("should handle organization parameter in all redirects", async () => {