From f2a8d0764b4db3d3b57db784c596853ab929e908 Mon Sep 17 00:00:00 2001 From: Simon Kobyda Date: Mon, 21 Aug 2023 17:14:08 +0200 Subject: [PATCH] lib: Add minimum progress value --- pkg/lib/cockpit-components-password.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/lib/cockpit-components-password.jsx b/pkg/lib/cockpit-components-password.jsx index 13827821ea79..15cfe30aba65 100644 --- a/pkg/lib/cockpit-components-password.jsx +++ b/pkg/lib/cockpit-components-password.jsx @@ -96,7 +96,9 @@ export const PasswordFormFields = ({ else variant = "danger"; - let passwordStrengthValue = Number.isInteger(passwordStrength) ? passwordStrength : 0; + let passwordStrengthValue = Number.isInteger(passwordStrength) ? Number.parseInt(passwordStrength) : -1; + if (password !== "" && (passwordStrengthValue >= 0 && passwordStrengthValue < 25)) + passwordStrengthValue = 25; return ( <>