Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
f6c45045f0 | |||
f95a951b26 | |||
e1ed228b8b | |||
0b3495a081 | |||
53c25b2e9a | |||
fcf8c4fd01 | |||
e91cb1a3b7 | |||
f06ff4d2c2 | |||
ef281889ab |
@ -4,6 +4,8 @@ Gregwar's CaptchaBundle
|
||||
The `GregwarCaptchaBundle` adds support for a captcha form type for the
|
||||
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
|
||||
==========================
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
gregwar_captcha.generate_captcha:
|
||||
pattern: /generate-captcha/{key}
|
||||
defaults: { _controller: GregwarCaptchaBundle:Captcha:generateCaptcha }
|
||||
path: /generate-captcha/{key}
|
||||
defaults: { _controller: GregwarCaptchaBundle:Captcha:generateCaptcha }
|
||||
|
@ -7,17 +7,17 @@ parameters:
|
||||
|
||||
services:
|
||||
captcha.type:
|
||||
class: %gregwar_captcha.captcha_type.class%
|
||||
class: '%gregwar_captcha.captcha_type.class%'
|
||||
arguments:
|
||||
- '@session'
|
||||
- '@gregwar_captcha.generator'
|
||||
- '@translator'
|
||||
- %gregwar_captcha.config%
|
||||
- '%gregwar_captcha.config%'
|
||||
tags:
|
||||
- { name: form.type, alias: captcha }
|
||||
|
||||
gregwar_captcha.generator:
|
||||
class: %gregwar_captcha.captcha_generator.class%
|
||||
class: '%gregwar_captcha.captcha_generator.class%'
|
||||
arguments:
|
||||
- '@router'
|
||||
- '@gregwar_captcha.captcha_builder'
|
||||
@ -25,15 +25,15 @@ services:
|
||||
- '@gregwar_captcha.image_file_handler'
|
||||
|
||||
gregwar_captcha.image_file_handler:
|
||||
class: %gregwar_captcha.image_file_handler.class%
|
||||
class: '%gregwar_captcha.image_file_handler.class%'
|
||||
arguments:
|
||||
- %gregwar_captcha.config.image_folder%
|
||||
- %gregwar_captcha.config.web_path%
|
||||
- %gregwar_captcha.config.gc_freq%
|
||||
- %gregwar_captcha.config.expiration%
|
||||
- '%gregwar_captcha.config.image_folder%'
|
||||
- '%gregwar_captcha.config.web_path%'
|
||||
- '%gregwar_captcha.config.gc_freq%'
|
||||
- '%gregwar_captcha.config.expiration%'
|
||||
|
||||
gregwar_captcha.captcha_builder:
|
||||
class: %gregwar_captcha.captcha_builder.class%
|
||||
class: '%gregwar_captcha.captcha_builder.class%'
|
||||
|
||||
gregwar_captcha.phrase_builder:
|
||||
class: %gregwar_captcha.phrase_builder.class%
|
||||
class: '%gregwar_captcha.phrase_builder.class%'
|
||||
|
@ -3,7 +3,7 @@
|
||||
-
|
||||
{% else %}
|
||||
{% 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 %}
|
||||
<script type="text/javascript">
|
||||
function reload_{{ image_id }}() {
|
||||
|
@ -143,7 +143,7 @@ class CaptchaType extends AbstractType
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
// Not using ::class to support Symfony 2.8 w/ php<5.5
|
||||
// Not using ::class to support Symfony 2.8 w/ php>=5.3.9
|
||||
return 'Symfony\Component\Form\Extension\Core\Type\TextType';
|
||||
}
|
||||
|
||||
@ -151,6 +151,14 @@ class CaptchaType extends AbstractType
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getBlockPrefix();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'captcha';
|
||||
}
|
||||
|
Reference in New Issue
Block a user