Merge pull request #172 from cengizhancaliskan/master
Support of multiple instance
This commit is contained in:
commit
dcae19ff63
|
@ -47,6 +47,7 @@ class Configuration implements ConfigurationInterface
|
||||||
->arrayNode('background_images')->prototype('scalar')->end()->end()
|
->arrayNode('background_images')->prototype('scalar')->end()->end()
|
||||||
->scalarNode('disabled')->defaultValue(false)->end()
|
->scalarNode('disabled')->defaultValue(false)->end()
|
||||||
->scalarNode('ignore_all_effects')->defaultValue(false)->end()
|
->scalarNode('ignore_all_effects')->defaultValue(false)->end()
|
||||||
|
->scalarNode('session_key')->defaultValue('captcha')->end()
|
||||||
->end()
|
->end()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ use Gregwar\CaptchaBundle\Generator\CaptchaGenerator;
|
||||||
*/
|
*/
|
||||||
class CaptchaType extends AbstractType
|
class CaptchaType extends AbstractType
|
||||||
{
|
{
|
||||||
|
const SESSION_KEY_PREFIX = '_captcha_';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SessionInterface
|
* @var SessionInterface
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +67,7 @@ class CaptchaType extends AbstractType
|
||||||
$validator = new CaptchaValidator(
|
$validator = new CaptchaValidator(
|
||||||
$this->translator,
|
$this->translator,
|
||||||
$this->session,
|
$this->session,
|
||||||
sprintf('gcb_%s', $builder->getForm()->getName()),
|
sprintf('%s%s', self::SESSION_KEY_PREFIX, $options['session_key']),
|
||||||
$options['invalid_message'],
|
$options['invalid_message'],
|
||||||
$options['bypass_code'],
|
$options['bypass_code'],
|
||||||
$options['humanity']
|
$options['humanity']
|
||||||
|
@ -83,7 +85,7 @@ class CaptchaType extends AbstractType
|
||||||
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
|
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sessionKey = sprintf('gcb_%s', $form->getName());
|
$sessionKey = sprintf('%s%s', self::SESSION_KEY_PREFIX, $options['session_key']);
|
||||||
$isHuman = false;
|
$isHuman = false;
|
||||||
|
|
||||||
if ($options['humanity'] > 0) {
|
if ($options['humanity'] > 0) {
|
||||||
|
|
Loading…
Reference in New Issue