Merge branch 'master' of github.com:Gregwar/CaptchaBundle
This commit is contained in:
commit
e3727a975d
@ -42,7 +42,8 @@ class Configuration implements ConfigurationInterface
|
||||
->scalarNode('max_front_lines')->defaultValue(null)->end()
|
||||
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
||||
->scalarNode('interpolation')->defaultValue(true)->end()
|
||||
->arrayNode('background_color')->prototype('scalar')->end()
|
||||
->arrayNode('text_color')->prototype('scalar')->end()->end()
|
||||
->arrayNode('background_color')->prototype('scalar')->end()->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -98,8 +98,17 @@ class CaptchaGenerator
|
||||
$this->builder->setMaxFrontLines($options['max_front_lines']);
|
||||
$this->builder->setMaxBehindLines($options['max_behind_lines']);
|
||||
|
||||
if ($options['background_color'] != array()) {
|
||||
if (count($options['background_color'])!=3) {
|
||||
if (isset($options['text_color']) && $options['text_color']) {
|
||||
if (count($options['text_color']) !== 3) {
|
||||
throw new \RuntimeException('text_color should be an array of r, g and b');
|
||||
}
|
||||
|
||||
$color = $options['text_color'];
|
||||
$this->builder->setTextColor($color[0], $color[1], $color[2]);
|
||||
}
|
||||
|
||||
if (isset($options['background_color']) && $options['background_color']) {
|
||||
if (count($options['background_color']) !== 3) {
|
||||
throw new \RuntimeException('background_color should be an array of r, g and b');
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ You can define the following configuration options globally or on the CaptchaTyp
|
||||
* **length**: the length of the captcha (number of chars, default 5)
|
||||
* **quality**: jpeg quality of captchas (default=15)
|
||||
* **charset**: the charset used for code generation (default=abcdefhjkmnprstuvwxyz23456789)
|
||||
* **font**: the font to use (default=Generator/Font/captcha.ttf)
|
||||
* **font**: the font to use (default is random among some pre-provided fonts), this should be an absolute path
|
||||
* **keep_value**: the value will be the same until the form is posted, even if the page is refreshed (default=true)
|
||||
* **as_file**: if set to true an image file will be created instead of embedding to please IE6/7 (default=false)
|
||||
* **as_url**: if set to true, a URL will be used in the image tag and will handle captcha generation. This can be used in a multiple-server environment and support IE6/7 (default=false)
|
||||
|
1
Resources/translations/gregwar_captcha.ru.yml
Normal file
1
Resources/translations/gregwar_captcha.ru.yml
Normal file
@ -0,0 +1 @@
|
||||
Renew: Обновить
|
1
Resources/translations/validators.ru.yml
Normal file
1
Resources/translations/validators.ru.yml
Normal file
@ -0,0 +1 @@
|
||||
Bad code value: Неправильный код
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user