【发布时间】:2014-10-07 18:55:27
【问题描述】:
我在让 gregwar 验证码在 Chrome 上工作时遇到了一些麻烦。 我有一个 symphony 2.3 上的网络应用程序并使用 gregwar 验证码(“dev-master”)。
我在表单上添加了验证码。
它在 IE 和 Firefox 上运行良好。
但是对于 Chrome,在表单验证之后,我总是会收到“错误的代码值”错误。
事实上,当我在compare函数上查看Gregwar\CaptchaBundle\Validator\CaptchaValidator.php 时,我确实有一个与code 不同的$expectedCode。
任何想法为什么它可以在 firefox 和 IE 上运行,但不能在 Chrome 上运行?
您可以在这里测试页面:http://www.nokachi-lyon.fr/contacts
有关信息,这是我的 Gregwar Captcha 实现:
在config.yml 我有:
gregwar_captcha:
width: 150
height: 35
length: 5
distortion: false
invalid_message: "My error message"
在Form 我有:
public function buildForm(FormBuilderInterface $builder, array $options){
$builder->add('myField','text')
->add('captcha', 'captcha');
}
在FormView 我有:
{% form_theme form with ['::captcha.html.twig','::formError.html.twig'] %}
<form action="{{ path('club_contacts') }}" method="post" {{ form_enctype(form) }}>
...
{{ form_widget(form.captcha) }}
...
</form>
在captcha.html.twig我有:
{% block captcha_widget %}
<p>My Message :
{{ form_widget(form) }}
<img src="{{ captcha_code }}" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" />
</p>
{% endblock %}
【问题讨论】:
标签: google-chrome symfony captcha symfony-2.3