Skip to content
Snippets Groups Projects
Commit ae216110 authored by Andreas De Rijcke's avatar Andreas De Rijcke Committed by Edouard Cunibil
Browse files

Issue #3314537 by andreasderijcke, DuaelFr: Make password errors more user friendly

parent bbb700e4
No related branches found
No related tags found
1 merge request!1Resolve #3314537 "Make password"
......@@ -105,10 +105,8 @@ function better_passwords_validate(array $element, FormStateInterface $form_stat
break;
case 'dictionary':
$matches[] = t('%str matches @dict dictionary (#@num)', [
$matches[] = t('Part %str matches a common password', [
'%str' => $str,
'@dict' => $obj->dictionaryName,
'@num' => $obj->rank,
]);
break;
......@@ -134,15 +132,9 @@ function better_passwords_validate(array $element, FormStateInterface $form_stat
}
}
}
$error = new FormattableMarkup(t('Please choose a stronger password. Current strength: @score. Minimum: @min.', [
'@score' => $strength['score'],
'@min' => $minStrength,
]) . '<ul><li>' . implode('</li><li>', $matches) . '</li></ul>', []);
$error = new FormattableMarkup(t('Please choose a stronger password.') . '<ul><li>' . implode('</li><li>', $matches) . '</li></ul>', []);
$form_state->setErrorByName('pass1', $error);
}
else {
\Drupal::messenger()->addMessage(t('Password strength: @score. Minimum: @min.', ['@score' => $strength['score'], '@min' => $minStrength]));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment