Champ de vérification Captcha pour un formulaire
Bonjour,
Je suis actuellement en train de développer un site avec Symfony et j'aurais besoin d'aide en ce qui concerne le rajout d'un champ de vérification Captcha à la fin d'un formulaire de contact.
Mon formulaire ContactForm est très simple, le voici :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <?php
class ContactForm extends sfForm
{
public function configure()
{
$this->setWidgets(array(
'Nom' => new sfWidgetFormInput(),
'Prenom' => new sfWidgetFormInput(),
'Email' => new sfWidgetFormInput(),
'Message' => new sfWidgetFormTextarea(),
));
$this->widgetSchema->setNameFormat('contact[%s]');
$this->setValidators(array(
'Nom' => new sfValidatorString(array('required' => true, 'min_length' => 3, 'max_length' => 50),
array('required' => 'Nom obligatoire', 'min_length' => 'Champ trop court', 'max_length' => 'Champ trop long')),
'Prenom' => new sfValidatorString(array('required' => true, 'min_length' => 3, 'max_length' => 50),
array('required' => 'Prenom obligatoire', 'min_length' => 'Champ trop court', 'max_length' => 'Champ trop long')),
'Email' => new sfValidatorEmail(array('required'=>true),
array('required' => 'Email obligatoire', 'invalid' => 'Adresse email invalide')),
'Message' => new sfValidatorString(array('required'=>true, 'min_length' => 4),
array('required' => 'Message obligatoire','min_length' => 'Le message est trop court'))
));
}
}
?> |
J'ai entendu parler de sfCaptchaPlugin mais je ne sais pas du tout comment l'installer et comment l'utiliser. Si quelqu'un pouvait me fournir quelques indications à ce niveau-là, je lui en serais très reconnaissant.
Merci d'avance pour votre aide !