[CaptchaType] Makes sure that the field is empty on form loading (fixes
This commit is contained in:
parent
bfd012ffe0
commit
53e5605103
|
@ -13,6 +13,7 @@ use Symfony\Component\Form\Exception\FormException;
|
|||
|
||||
use Gregwar\CaptchaBundle\Validator\CaptchaValidator;
|
||||
use Gregwar\CaptchaBundle\Generator\CaptchaGenerator;
|
||||
use Gregwar\CaptchaBundle\DataTransformer\EmptyTransformer;
|
||||
|
||||
/**
|
||||
* Captcha type
|
||||
|
@ -121,6 +122,7 @@ class CaptchaType extends AbstractType
|
|||
public function buildForm(FormBuilder $builder, array $options)
|
||||
{
|
||||
$this->key = $builder->getForm()->getName();
|
||||
|
||||
$builder->addValidator(
|
||||
new CaptchaValidator($this->session, $this->key)
|
||||
);
|
||||
|
@ -147,6 +149,8 @@ class CaptchaType extends AbstractType
|
|||
if ($this->keepValue) {
|
||||
$this->session->set($this->key.'_fingerprint', $generator->getFingerprint());
|
||||
}
|
||||
|
||||
$view->set('value', '');
|
||||
}
|
||||
|
||||
public function getDefaultOptions(array $options = array())
|
||||
|
|
Loading…
Reference in New Issue