diff --git a/web/package/agama-web-ui.changes b/web/package/agama-web-ui.changes index 32da03c73d..76e5ba1932 100644 --- a/web/package/agama-web-ui.changes +++ b/web/package/agama-web-ui.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Feb 11 16:00:34 UTC 2026 - David Diaz + +- Do not show warnings about password strength + (gh#agama-project/agama#3156). + ------------------------------------------------------------------- Wed Feb 11 13:35:13 UTC 2026 - Ladislav Slezák diff --git a/web/src/components/storage/EncryptionSection.test.tsx b/web/src/components/storage/EncryptionSection.test.tsx index 928679e340..0919230fd5 100644 --- a/web/src/components/storage/EncryptionSection.test.tsx +++ b/web/src/components/storage/EncryptionSection.test.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) [2024-2025] SUSE LLC + * Copyright (c) [2024-2026] SUSE LLC * * All Rights Reserved. * @@ -31,8 +31,6 @@ jest.mock("~/hooks/model/storage/config-model", () => ({ useConfigModel: () => mockUseConfigModel(), })); -jest.mock("~/components/users/PasswordCheck", () => () =>
PasswordCheck Mock
); - describe("EncryptionSection", () => { describe("if encryption is enabled", () => { beforeEach(() => { diff --git a/web/src/components/storage/EncryptionSection.tsx b/web/src/components/storage/EncryptionSection.tsx index e0357e9c64..52616d3578 100644 --- a/web/src/components/storage/EncryptionSection.tsx +++ b/web/src/components/storage/EncryptionSection.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) [2024-2025] SUSE LLC + * Copyright (c) [2024-2026] SUSE LLC * * All Rights Reserved. * @@ -28,7 +28,6 @@ import Icon from "~/components/layout/Icon"; import { useConfigModel } from "~/hooks/model/storage/config-model"; import { STORAGE } from "~/routes/paths"; import { _ } from "~/i18n"; -import PasswordCheck from "~/components/users/PasswordCheck"; import type { ConfigModel } from "~/model/storage/config-model"; function encryptionLabel(method?: ConfigModel.EncryptionMethod) { @@ -42,7 +41,6 @@ export default function EncryptionSection() { const configModel = useConfigModel(); const encryption = configModel?.encryption; const method = encryption?.method; - const password = encryption?.password; return ( @@ -53,7 +51,6 @@ export default function EncryptionSection() { )} {encryptionLabel(method)} - {password && } diff --git a/web/src/components/storage/EncryptionSettingsPage.test.tsx b/web/src/components/storage/EncryptionSettingsPage.test.tsx index 6fa6c64af9..503cb71d7e 100644 --- a/web/src/components/storage/EncryptionSettingsPage.test.tsx +++ b/web/src/components/storage/EncryptionSettingsPage.test.tsx @@ -26,8 +26,6 @@ import { installerRender } from "~/test-utils"; import EncryptionSettingsPage from "./EncryptionSettingsPage"; import type { ConfigModel } from "~/model/storage/config-model"; -jest.mock("~/components/users/PasswordCheck", () => () =>
PasswordCheck Mock
); - const mockLuks2Config: ConfigModel.Config = { encryption: { method: "luks2", diff --git a/web/src/components/storage/EncryptionSettingsPage.tsx b/web/src/components/storage/EncryptionSettingsPage.tsx index ac4a2f3a63..3ae2c13783 100644 --- a/web/src/components/storage/EncryptionSettingsPage.tsx +++ b/web/src/components/storage/EncryptionSettingsPage.tsx @@ -24,7 +24,6 @@ import React, { useEffect, useState, useRef } from "react"; import { useLocation, useNavigate } from "react-router"; import { ActionGroup, Alert, Checkbox, Form } from "@patternfly/react-core"; import { NestedContent, Page, PasswordAndConfirmationInput } from "~/components/core"; -import PasswordCheck from "~/components/users/PasswordCheck"; import { useEncryptionMethods } from "~/hooks/model/system/storage"; import { useConfigModel, useSetEncryption } from "~/hooks/model/storage/config-model"; import { isEmpty } from "radashi"; @@ -137,7 +136,6 @@ at the new file systems, including data, programs, and system files.", isDisabled={!isEnabled} showErrors={false} /> - {isTpmAvailable && ( { -
diff --git a/web/src/components/users/FirstUserForm.test.tsx b/web/src/components/users/FirstUserForm.test.tsx index 55093dd60e..c05fba3227 100644 --- a/web/src/components/users/FirstUserForm.test.tsx +++ b/web/src/components/users/FirstUserForm.test.tsx @@ -31,8 +31,6 @@ let mockPassword: string; let mockHashedPassword: boolean; const mockPatchConfig = jest.fn().mockResolvedValue(true); -jest.mock("~/components/users/PasswordCheck", () => () =>
PasswordCheck Mock
); - jest.mock("~/hooks/model/config", () => ({ ...jest.requireActual("~/hooks/model/config"), useConfig: () => ({ diff --git a/web/src/components/users/FirstUserForm.tsx b/web/src/components/users/FirstUserForm.tsx index c84561b2b1..5582bd8d54 100644 --- a/web/src/components/users/FirstUserForm.tsx +++ b/web/src/components/users/FirstUserForm.tsx @@ -36,7 +36,6 @@ import { } from "@patternfly/react-core"; import { useNavigate } from "react-router"; import { PasswordAndConfirmationInput, Page } from "~/components/core"; -import PasswordCheck from "~/components/users/PasswordCheck"; import { suggestUsernames } from "~/components/users/utils"; import { useConfig } from "~/hooks/model/config"; import { patchConfig } from "~/api"; @@ -242,7 +241,6 @@ export default function FirstUserForm() { showErrors={false} onChange={(_, value) => setPassword(value)} /> - )} diff --git a/web/src/components/users/PasswordCheck.test.tsx b/web/src/components/users/PasswordCheck.test.tsx deleted file mode 100644 index 62184c3569..0000000000 --- a/web/src/components/users/PasswordCheck.test.tsx +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) [2025] SUSE LLC - * - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, contact SUSE LLC. - * - * To contact SUSE LLC about this file by physical or electronic mail, you may - * find current contact information at www.suse.com. - */ - -import React from "react"; -import { screen } from "@testing-library/react"; -import { plainRender } from "~/test-utils"; -import PasswordCheck from "./PasswordCheck"; - -const mockCheckPasswordFn = jest.fn(); - -jest.mock("~/model/users", () => ({ - ...jest.requireActual("~/model/users"), - checkPassword: (password) => mockCheckPasswordFn(password), -})); - -describe("when the password is empty", () => { - it("renders nothing", () => { - const { container } = plainRender(); - expect(container).toBeEmptyDOMElement(); - }); -}); - -describe("when the password is not valid", () => { - beforeEach(() => { - mockCheckPasswordFn.mockResolvedValueOnce({ - failure: "Shorter than 8 characters", - }); - }); - - it("informs the user", async () => { - plainRender(); - await screen.findByText("Shorter than 8 characters"); - }); -}); - -describe("when the password is weak", () => { - beforeEach(() => { - mockCheckPasswordFn.mockResolvedValueOnce({ - success: 30, - }); - }); - - it("informs the user", async () => { - plainRender(); - await screen.findByText("The password is weak"); - }); -}); - -describe("when the password is strong", () => { - beforeEach(() => { - mockCheckPasswordFn.mockResolvedValueOnce({ - success: 90, - }); - }); - - it("renders nothing", () => { - const { container } = plainRender(); - expect(container).toBeEmptyDOMElement(); - }); -}); diff --git a/web/src/components/users/PasswordCheck.tsx b/web/src/components/users/PasswordCheck.tsx deleted file mode 100644 index 894a9040ec..0000000000 --- a/web/src/components/users/PasswordCheck.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) [2025] SUSE LLC - * - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, contact SUSE LLC. - * - * To contact SUSE LLC about this file by physical or electronic mail, you may - * find current contact information at www.suse.com. - */ - -import React, { useEffect, useState } from "react"; -import SmallWarning from "~/components/core/SmallWarning"; -import { checkPassword } from "~/model/users"; -import { _, TranslatedString } from "~/i18n"; - -const MINIMAL_SCORE = 50; - -const PasswordCheck = ({ password }: { password: string }) => { - const [error, setError] = useState(); - - useEffect(() => { - if (!password) return; - - checkPassword(password).then((result) => { - if (result.failure) { - setError(result.failure); - } else if (result.success && result.success < MINIMAL_SCORE) { - setError(_("The password is weak")); - } else { - setError(undefined); - } - }); - }, [password]); - - if (!error) return; - - return ( -
- -
- ); -}; - -export default PasswordCheck; diff --git a/web/src/components/users/RootUser.tsx b/web/src/components/users/RootUser.tsx index 8bdf82fe7d..9fe1545971 100644 --- a/web/src/components/users/RootUser.tsx +++ b/web/src/components/users/RootUser.tsx @@ -1,5 +1,5 @@ /* - * Copyright (c) [2023-2025] SUSE LLC + * Copyright (c) [2023-2026] SUSE LLC * * All Rights Reserved. * @@ -32,7 +32,6 @@ import { Stack, } from "@patternfly/react-core"; import { Link, Page } from "~/components/core"; -import PasswordCheck from "~/components/users/PasswordCheck"; import { useConfig } from "~/hooks/model/config"; import { USER } from "~/routes/paths"; import { isEmpty } from "radashi"; @@ -73,7 +72,6 @@ export default function RootUser() { - {password && } diff --git a/web/src/components/users/RootUserForm.test.tsx b/web/src/components/users/RootUserForm.test.tsx index 504976e955..373da771ec 100644 --- a/web/src/components/users/RootUserForm.test.tsx +++ b/web/src/components/users/RootUserForm.test.tsx @@ -30,8 +30,6 @@ let mockPublicKey: string; let mockHashedPassword: boolean; const mockPatchConfig = jest.fn().mockResolvedValue(true); -jest.mock("~/components/users/PasswordCheck", () => () =>
PasswordCheck Mock
); - jest.mock("~/hooks/model/config", () => ({ ...jest.requireActual("~/hooks/model/config"), useConfig: () => ({ diff --git a/web/src/components/users/RootUserForm.tsx b/web/src/components/users/RootUserForm.tsx index c8b17e526c..fb6f4ba6c2 100644 --- a/web/src/components/users/RootUserForm.tsx +++ b/web/src/components/users/RootUserForm.tsx @@ -38,7 +38,6 @@ import { patchConfig } from "~/api"; import type { Root } from "~/model/config"; import { isEmpty } from "radashi"; import { _ } from "~/i18n"; -import PasswordCheck from "~/components/users/PasswordCheck"; import { USER } from "~/routes/paths"; const AVAILABLE_METHODS = ["password", "sshPublicKey"] as const; @@ -169,7 +168,6 @@ const RootUserForm = () => { onChange={onPasswordChange} showErrors={false} /> - )} diff --git a/web/src/model/users.ts b/web/src/model/users.ts index da9c19bff5..aeb603c63c 100644 --- a/web/src/model/users.ts +++ b/web/src/model/users.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) [2024] SUSE LLC + * Copyright (c) [2024-2026] SUSE LLC * * All Rights Reserved. * @@ -22,9 +22,8 @@ // @todo Move to the new API. -import { AxiosResponse } from "axios"; -import { del, get, patch, post, put } from "~/http"; -import { FirstUser, PasswordCheckResult, RootUser } from "~/types/users"; +import { del, get, patch, put } from "~/http"; +import { FirstUser, RootUser } from "~/types/users"; /** * Returns the first user's definition @@ -55,16 +54,4 @@ const fetchRoot = (): Promise => get("/api/users/root"); */ const updateRoot = (changes: Partial) => patch("/api/users/root", changes); -/** - * Checks the strength of the given password. - * - * @param password - Password to check. - */ -const checkPassword = async (password: string): Promise => { - const response: AxiosResponse = await post("/api/users/password_check", { - password, - }); - return response.data; -}; - -export { fetchFirstUser, updateFirstUser, removeFirstUser, fetchRoot, updateRoot, checkPassword }; +export { fetchFirstUser, updateFirstUser, removeFirstUser, fetchRoot, updateRoot }; diff --git a/web/src/types/users.ts b/web/src/types/users.ts index 51d780f67b..d7ae2f9864 100644 --- a/web/src/types/users.ts +++ b/web/src/types/users.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) [2024] SUSE LLC + * Copyright (c) [2024-2026] SUSE LLC * * All Rights Reserved. * @@ -20,8 +20,6 @@ * find current contact information at www.suse.com. */ -import { TranslatedString } from "~/i18n"; - type FirstUser = { fullName: string; userName: string; @@ -35,9 +33,4 @@ type RootUser = { sshPublicKey: string; }; -type PasswordCheckResult = { - success?: number; - failure?: TranslatedString; -}; - -export type { FirstUser, RootUser, PasswordCheckResult }; +export type { FirstUser, RootUser };