From 5accaf88b9ea8fea646efe90cd9d8ccdf85e2f70 Mon Sep 17 00:00:00 2001 From: Alex Donesky Date: Wed, 14 Dec 2022 19:20:55 -0600 Subject: [PATCH] add back error when password is too short (#16876) --- .../create-password/create-password.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ui/pages/onboarding-flow/create-password/create-password.js b/ui/pages/onboarding-flow/create-password/create-password.js index b31858de1..369d45ead 100644 --- a/ui/pages/onboarding-flow/create-password/create-password.js +++ b/ui/pages/onboarding-flow/create-password/create-password.js @@ -85,13 +85,14 @@ export default function CreatePassword({ const handlePasswordChange = (passwordInput) => { let confirmError = ''; + let passwordInputError = ''; const passwordEvaluation = zxcvbn(passwordInput); const passwordStrengthLabel = getPasswordStrengthLabel( passwordEvaluation.score, t, ); - const passwordStrengthDescription = passwordStrengthLabel.description; - const passwordStrengthInput = t('passwordStrength', [ + let passwordStrengthDescription = passwordStrengthLabel.description; + let passwordStrengthInput = t('passwordStrength', [ , ]); + if (passwordInput.length < 8) { + passwordInputError = passwordInput.length + ? t('passwordNotLongEnough') + : ''; + passwordStrengthInput = null; + passwordStrengthDescription = ''; + } + if (confirmPassword && passwordInput !== confirmPassword) { confirmError = t('passwordsDontMatch'); } setPassword(passwordInput); + setPasswordError(passwordInputError); setPasswordStrength(passwordStrengthInput); setPasswordStrengthText(passwordStrengthDescription); setConfirmPasswordError(confirmError); @@ -175,6 +185,7 @@ export default function CreatePassword({