Moving the "reload without as_url" exception to catch more cases (see

This commit is contained in:
Gregwar 2013-08-07 10:56:49 +02:00
parent 5efb9a73b5
commit 7f30646c68
2 changed files with 4 additions and 4 deletions

View File

@ -33,10 +33,6 @@ class GregwarCaptchaExtension extends Extension
$container->setParameter('gregwar_captcha.config.expiration', $config['expiration']);
$container->setParameter('gregwar_captcha.config.whitelist_key', $config['whitelist_key']);
if ($config['reload'] && !$config['as_url']) {
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
}
$resources = $container->getParameter('twig.form.resources');
$container->setParameter('twig.form.resources', array_merge(array('GregwarCaptchaBundle::captcha.html.twig'), $resources));
}

View File

@ -90,6 +90,10 @@ class CaptchaType extends AbstractType
{
$isHuman = false;
if ($options['reload'] && !$options['as_url']) {
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
}
if ($options['humanity'] > 0) {
$humanityKey = $this->key.'_humanity';
if ($this->session->get($humanityKey, 0) > 0) {