diff --git a/src/Maker/MakeResetPassword.php b/src/Maker/MakeResetPassword.php index 5409d9adc..d02470180 100644 --- a/src/Maker/MakeResetPassword.php +++ b/src/Maker/MakeResetPassword.php @@ -53,6 +53,8 @@ use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\NotCompromisedPassword; +use Symfony\Component\Validator\Constraints\PasswordStrength; use Symfony\Component\Validator\Validation; use Symfony\Component\Yaml\Yaml; use Symfony\Contracts\Translation\TranslatorInterface; @@ -292,6 +294,8 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen OptionsResolver::class, Length::class, NotBlank::class, + NotCompromisedPassword::class, + PasswordStrength::class, ]); $generator->generateClass( diff --git a/src/Resources/skeleton/resetPassword/ChangePasswordFormType.tpl.php b/src/Resources/skeleton/resetPassword/ChangePasswordFormType.tpl.php index 2efc53ac2..95eb7410f 100644 --- a/src/Resources/skeleton/resetPassword/ChangePasswordFormType.tpl.php +++ b/src/Resources/skeleton/resetPassword/ChangePasswordFormType.tpl.php @@ -22,11 +22,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'message' => 'Please enter a password', ]), new Length([ - 'min' => 6, + 'min' => 12, 'minMessage' => 'Your password should be at least {{ limit }} characters', // max length allowed by Symfony for security reasons 'max' => 4096, ]), + new PasswordStrength(), + new NotCompromisedPassword(), ], 'label' => 'New password', ],