diff --git a/apps/desktop/src/components/ChangePassword/ChangePasswordForm.test.tsx b/apps/desktop/src/components/ChangePassword/ChangePasswordForm.test.tsx index 3240dd112c..dd8afc071d 100644 --- a/apps/desktop/src/components/ChangePassword/ChangePasswordForm.test.tsx +++ b/apps/desktop/src/components/ChangePassword/ChangePasswordForm.test.tsx @@ -46,7 +46,7 @@ describe("ChangePassword Form", () => { }); }); - it("requires 8 characters", async () => { + it("requires 12 characters", async () => { render(fixture()); const newPasswordInput = screen.getByTestId("new-password"); @@ -55,7 +55,7 @@ describe("ChangePassword Form", () => { await waitFor(() => { expect(screen.getByTestId("new-password-error")).toHaveTextContent( - "Your password must be at least 8 characters long" + "Your password must be at least 12 characters long" ); }); }); diff --git a/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.test.tsx b/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.test.tsx index 365114648d..52110db863 100644 --- a/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.test.tsx +++ b/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.test.tsx @@ -3,6 +3,8 @@ import { renderInModal, screen, userEvent } from "../../testUtils"; const mockOnSubmit = jest.fn(); +const password = "Qwerty123123!23vcxz"; + describe("", () => { it("calls onSubmit with entered password when form is submitted", async () => { const user = userEvent.setup(); diff --git a/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.tsx b/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.tsx index adb9ed3480..25c827904c 100644 --- a/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.tsx +++ b/apps/web/src/components/MasterPasswordModal/MasterPasswordModal.tsx @@ -51,8 +51,8 @@ export const MasterPasswordModal = ({ onSubmit }: MasterPasswordModalProps) => { data-testid="master-password" inputName="password" label="Password" + minLength={0} placeholder="Enter your password" - required="Password is required" /> diff --git a/apps/web/src/components/Menu/ChangePasswordMenu/ChangePasswordMenu.test.tsx b/apps/web/src/components/Menu/ChangePasswordMenu/ChangePasswordMenu.test.tsx index 6581a5a946..36f93b5e1f 100644 --- a/apps/web/src/components/Menu/ChangePasswordMenu/ChangePasswordMenu.test.tsx +++ b/apps/web/src/components/Menu/ChangePasswordMenu/ChangePasswordMenu.test.tsx @@ -9,6 +9,9 @@ jest.mock("@umami/state", () => ({ changeMnemonicPassword: jest.fn(), })); +const currentPassword = "Qwerty123123!23vcxz"; +const newPassword = "Qwerty123123!23vcxz32llll"; + describe("", () => { describe("currentPassword", () => { it("is empty by default", async () => { @@ -47,7 +50,7 @@ describe("", () => { }); }); - it("requires 8 characters", async () => { + it("requires 12 characters", async () => { const user = userEvent.setup(); await renderInDrawer(); @@ -57,7 +60,7 @@ describe("", () => { await waitFor(() => { expect(screen.getByTestId("new-password-error")).toHaveTextContent( - "Your password must be at least 8 characters long" + "Your password must be at least 12 characters long" ); }); }); @@ -108,9 +111,9 @@ describe("", () => { const newPasswordInput = screen.getByTestId("new-password"); const newPasswordConfirmationInput = screen.getByTestId("new-password-confirmation"); - await user.type(currentPasswordInput, "myOldPassword"); - await user.type(newPasswordInput, "myNewPassword"); - await user.type(newPasswordConfirmationInput, "myNewPassword"); + await user.type(currentPasswordInput, currentPassword); + await user.type(newPasswordInput, newPassword); + await user.type(newPasswordConfirmationInput, newPassword); expect(screen.getByRole("button", { name: "Update Password" })).toBeEnabled(); }); @@ -123,15 +126,15 @@ describe("", () => { const newPasswordInput = screen.getByTestId("new-password"); const newPasswordConfirmationInput = screen.getByTestId("new-password-confirmation"); - await user.type(currentPasswordInput, "myOldPassword"); - await user.type(newPasswordInput, "myNewPassword"); - await user.type(newPasswordConfirmationInput, "myNewPassword"); + await user.type(currentPasswordInput, currentPassword); + await user.type(newPasswordInput, newPassword); + await user.type(newPasswordConfirmationInput, newPassword); await user.click(screen.getByRole("button", { name: "Update Password" })); expect(changeMnemonicPassword).toHaveBeenCalledWith({ - currentPassword: "myOldPassword", - newPassword: "myNewPassword", + currentPassword: currentPassword, + newPassword: newPassword, }); }); }); diff --git a/apps/web/src/components/Menu/Menu.test.tsx b/apps/web/src/components/Menu/Menu.test.tsx index 95cf7f7166..b9830bd181 100644 --- a/apps/web/src/components/Menu/Menu.test.tsx +++ b/apps/web/src/components/Menu/Menu.test.tsx @@ -34,6 +34,7 @@ jest.mock("@umami/state", () => ({ let store: UmamiStore; const account = mockImplicitAccount(0); +const password = "Qwerty123123!23vcxz"; beforeEach(() => { store = makeStore(); @@ -96,8 +97,8 @@ describe("", () => { await user.click(screen.getByText("Save Backup")); - await user.type(screen.getByLabelText("Set Password"), "password"); - await user.type(screen.getByLabelText("Confirm Password"), "password"); + await user.type(screen.getByLabelText("Set Password"), password); + await user.type(screen.getByLabelText("Confirm Password"), password); await user.click(screen.getByRole("button", { name: "Save Backup" })); expect(mockDownloadBackupFile).toHaveBeenCalled(); diff --git a/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.test.tsx b/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.test.tsx index bf1a609e1f..832df08afe 100644 --- a/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.test.tsx +++ b/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.test.tsx @@ -31,7 +31,7 @@ jest.mock("@umami/state", () => ({ useIsPasswordSet: jest.fn(), })); -const password = "password"; +const password = "Qwerty123123!23vcxz"; beforeEach(() => { jest.mocked(useGetDecryptedMnemonic).mockReturnValue(() => Promise.resolve(mnemonic1)); diff --git a/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.tsx b/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.tsx index e0d6f9ec4a..80a18df3a0 100644 --- a/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.tsx +++ b/apps/web/src/components/Onboarding/SetupPassword/SetupPassword.tsx @@ -112,7 +112,7 @@ export const SetupPassword = ({ mode }: SetupPasswordProps) => { const downloadBackupFile = useDownloadBackupFile(); const form = useMultiForm({ - mode: "onChange", + mode: "all", defaultValues: { derivationPath: defaultDerivationPathTemplate, curve: "ed25519", @@ -201,6 +201,7 @@ export const SetupPassword = ({ mode }: SetupPasswordProps) => { checkPasswordStrength={!isPasswordSet} inputName="password" label={isPasswordSet ? "Password" : "Set Password"} + required="Password is required" /> {!isPasswordSet && (