12 Commits

Author SHA1 Message Date
639430383f Merge pull request #180 from andreybolonin/master
add sf 4.0 support
2017-12-28 12:21:03 +01:00
8e98c5c0ab add public services 2017-12-28 12:30:19 +02:00
539884cd5d add sf 4.0 support 2017-11-27 18:08:24 +02:00
8ce4adb1b1 Adding background_images in persisted options (fixes #175) 2017-10-02 11:12:17 +02:00
b787a8002e Rising default quality to 50 2017-09-27 12:01:02 +02:00
045ba7e67e Merge pull request #150 from dprolife/patch-1
Update composer.json
2017-02-23 10:26:22 +01:00
18c85d3a4f donate 2016-10-24 12:05:50 +02:00
f6c45045f0 Adding class captcha_image on the <img> captcha tag (see #160) 2016-09-21 10:36:55 +02:00
f95a951b26 Detail 2016-08-05 20:07:20 +02:00
e1ed228b8b Merge pull request #168 from linnaea/patch-1
Quote parameter references in services.yml
2016-05-30 12:28:28 +02:00
0b3495a081 Quote parameter references in services.yml
Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.
2016-05-28 22:40:00 +08:00
1f6c80c326 Update composer.json
Fix symfony requirements
2015-12-17 22:51:31 +01:00
6 changed files with 25 additions and 15 deletions

View File

@ -33,7 +33,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('web_path')->defaultValue('%kernel.root_dir%/../web')->end() ->scalarNode('web_path')->defaultValue('%kernel.root_dir%/../web')->end()
->scalarNode('gc_freq')->defaultValue(100)->end() ->scalarNode('gc_freq')->defaultValue(100)->end()
->scalarNode('expiration')->defaultValue(60)->end() ->scalarNode('expiration')->defaultValue(60)->end()
->scalarNode('quality')->defaultValue(30)->end() ->scalarNode('quality')->defaultValue(50)->end()
->scalarNode('invalid_message')->defaultValue('Bad code value')->end() ->scalarNode('invalid_message')->defaultValue('Bad code value')->end()
->scalarNode('bypass_code')->defaultValue(null)->end() ->scalarNode('bypass_code')->defaultValue(null)->end()
->scalarNode('whitelist_key')->defaultValue('captcha_whitelist_key')->end() ->scalarNode('whitelist_key')->defaultValue('captcha_whitelist_key')->end()

View File

@ -1,9 +1,13 @@
Gregwar's CaptchaBundle Gregwar's CaptchaBundle
===================== =====================
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YUXRLWHQSWS6L)
The `GregwarCaptchaBundle` adds support for a captcha form type for the The `GregwarCaptchaBundle` adds support for a captcha form type for the
Symfony form component. Symfony form component.
It uses [gregwar/captcha](https://github.com/Gregwar/Captcha) as captcha generator, which is a separate standalone library that can be used for none-symfony projects.
Compatibility with Symfony Compatibility with Symfony
========================== ==========================

View File

@ -7,17 +7,19 @@ parameters:
services: services:
captcha.type: captcha.type:
class: %gregwar_captcha.captcha_type.class% class: '%gregwar_captcha.captcha_type.class%'
public: true
arguments: arguments:
- '@session' - '@session'
- '@gregwar_captcha.generator' - '@gregwar_captcha.generator'
- '@translator' - '@translator'
- %gregwar_captcha.config% - '%gregwar_captcha.config%'
tags: tags:
- { name: form.type, alias: captcha } - { name: form.type, alias: captcha }
gregwar_captcha.generator: gregwar_captcha.generator:
class: %gregwar_captcha.captcha_generator.class% class: '%gregwar_captcha.captcha_generator.class%'
public: true
arguments: arguments:
- '@router' - '@router'
- '@gregwar_captcha.captcha_builder' - '@gregwar_captcha.captcha_builder'
@ -25,15 +27,18 @@ services:
- '@gregwar_captcha.image_file_handler' - '@gregwar_captcha.image_file_handler'
gregwar_captcha.image_file_handler: gregwar_captcha.image_file_handler:
class: %gregwar_captcha.image_file_handler.class% class: '%gregwar_captcha.image_file_handler.class%'
public: true
arguments: arguments:
- %gregwar_captcha.config.image_folder% - '%gregwar_captcha.config.image_folder%'
- %gregwar_captcha.config.web_path% - '%gregwar_captcha.config.web_path%'
- %gregwar_captcha.config.gc_freq% - '%gregwar_captcha.config.gc_freq%'
- %gregwar_captcha.config.expiration% - '%gregwar_captcha.config.expiration%'
gregwar_captcha.captcha_builder: gregwar_captcha.captcha_builder:
class: %gregwar_captcha.captcha_builder.class% class: '%gregwar_captcha.captcha_builder.class%'
public: true
gregwar_captcha.phrase_builder: gregwar_captcha.phrase_builder:
class: %gregwar_captcha.phrase_builder.class% class: '%gregwar_captcha.phrase_builder.class%'
public: true

View File

@ -3,7 +3,7 @@
- -
{% else %} {% else %}
{% spaceless %} {% spaceless %}
<img id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" /> <img class="captcha_image" id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" />
{% if reload %} {% if reload %}
<script type="text/javascript"> <script type="text/javascript">
function reload_{{ image_id }}() { function reload_{{ image_id }}() {

View File

@ -113,7 +113,8 @@ class CaptchaType extends AbstractType
)); ));
$persistOptions = array(); $persistOptions = array();
foreach (array('phrase', 'width', 'height', 'distortion', 'length', 'quality', 'background_color', 'text_color') as $key) { foreach (array('phrase', 'width', 'height', 'distortion', 'length',
'quality', 'background_color', 'background_images', 'text_color') as $key) {
$persistOptions[$key] = $options[$key]; $persistOptions[$key] = $options[$key];
} }

View File

@ -19,8 +19,8 @@
"require": { "require": {
"php": ">=5.3.9", "php": ">=5.3.9",
"gregwar/captcha": "~1.1", "gregwar/captcha": "~1.1",
"symfony/framework-bundle": "~2.1|~3.0", "symfony/framework-bundle": "~2.8|~3.0|~4.0",
"symfony/form": "~2.1|~3.0" "symfony/form": "~2.8|~3.0|~4.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {