From 70b8d08e3816661bbbb5bbcd9b8ffca66aa8a602 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 d47007aeb03e..780e1fcd10d4 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 ( <>