From d621699ca4b03a3d64cfdda7ff053939acb14e95 Mon Sep 17 00:00:00 2001 From: Timon_bed Date: Fri, 28 Aug 2026 17:27:50 +0200 Subject: [PATCH] fix: show short password labels as invalid Ensure minimum-length failures use the destructive token even when the password's entropy score is strong. Co-authored-by: Cursor --- src/components/ui/password-strength.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/ui/password-strength.tsx b/src/components/ui/password-strength.tsx index 1860049c4..8d82611b4 100644 --- a/src/components/ui/password-strength.tsx +++ b/src/components/ui/password-strength.tsx @@ -69,11 +69,12 @@ export function PasswordStrength({ t("passwordStrength.strong"), t("passwordStrength.veryStrong"), ]; - const tooShort = password.length < minLength; + const isTooShort = password.length < minLength; + const labelColor = isTooShort ? "text-destructive" : colors.textColor; // Collect feedback const feedback: string[] = []; - if (tooShort) { + if (isTooShort) { feedback.push(t("passwordStrength.minLength", { count: minLength })); } if (result?.feedback?.warning) { @@ -92,7 +93,7 @@ export function PasswordStrength({ key={i} className={cn( "h-1.5 flex-1 rounded-full transition-colors", - i <= score && !tooShort ? colors.color : "bg-muted", + i <= score && !isTooShort ? colors.color : "bg-muted", )} /> ))} @@ -100,8 +101,8 @@ export function PasswordStrength({ {/* Label */}
- - {tooShort ? t("passwordStrength.tooShort") : scoreLabels[score]} + + {isTooShort ? t("passwordStrength.tooShort") : scoreLabels[score]} {password.length}/{minLength}+ {t("passwordStrength.characters")}