PasswordValidator('The description of my validator, displayed when choosing a password'); } function validate($pwd) { //Check that the $pwd is valid ... return false || true; } } */ /* Below is your strategy used to validate the passwords. Feel free to (un)comment the following lines to feed your needs. Do not forget to add your custom validators. */ $password_strategy->add(new PasswordRegexpValidator('/.{8,}/', 'Le mot de passe doit contenir au minimum 8 caractères.')); //$password_strategy->add(new PasswordRegexpValidator('/[^a-zA-Z0-9]{2,}/', 'Le mot de passe doit contenir au minimum 2 caractères spéciaux.')); //$password_strategy->add(new PasswordRegexpValidator('/[a-z]{1,}/', 'Le mot de passe doit contenir une lettre minuscule.')); //$password_strategy->add(new PasswordRegexpValidator('/[A-Z]{1,}/', 'Le mot de passe doit contenir une lettre majuscule.')); $password_strategy->add(new PasswordRegexpValidator('/[0-9]{1,}/', 'Le mot de passe doit contenir un chiffre.')); //$password_strategy->add(new MyPasswordValidator()); ?>