【发布时间】:2012-05-28 22:16:24
【问题描述】:
是否可以自定义 reCAPTCHA 表单参数(recaptcha_challenge_field 和 recaptcha_response_field)以便以不同方式调用它们?
基本上我希望表单参数 recaptcha_challenge_field 被称为 captchaId, recaptcha_response_field 被称为 captchaUserResponse。
我希望它们重命名,以便我可以抽象验证码实现...当请求到达时
POST /mysite/userSignup
我不想为验证码实现(reCaptcha 或将来的其他东西)而烦恼 - 为正确的验证码实现提取正确的参数,我想统一这些参数名称。
现在我的请求如下所示:
POST /mysite/userSignup HTTP/1.1
Host: localhost:80
Connection: keep-alive
Content-Length: 416
Cache-Control: max-age=0
Origin: http://localhost:80
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://localhost:8080/mysite/signup/form.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,hr;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
email:testUser%40gmail.com
username:testUser
password:test
password2:test
forename:Test
surname:User
recaptcha_challenge_field:<google generated challange>
recaptcha_response_field:<user typed captcha answer>
submit:Submit
但我希望它看起来像这样:
POST /mysite/userSignup HTTP/1.1
Host: localhost:80
Connection: keep-alive
Content-Length: 416
Cache-Control: max-age=0
Origin: http://localhost:80
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://localhost:8080/mysite/signup/form.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,hr;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
email:testUser%40gmail.com
username:testUser
password:test
password2:test
forename:Test
surname:User
captchaId:<google generated challange>
captchaUserResponse:<user typed captcha answer>
submit:Submit
一种优雅的方法是像这样指定这些表单参数名称:
<script>
var RecaptchaOptions = {
recaptcha_challenge_field_formparam_name : 'captchaId',
recaptcha_response_field_formparam_name: 'captchaUserResponse'
};
</script>
如果这不可行,您建议什么解决方法?
【问题讨论】:
标签: javascript forms http captcha recaptcha