是否可以自定义 reCAPTCHA 表单参数(recaptcha_challenge_field和recaptcha_response_field)以便以不同方式调用它们?
基本上,我希望将表单参数recaptcha_challenge_field称为captchaId,并将recaptcha_response_field称为captchaUserResponse。
我希望它们重命名,以便我可以抽象验证码实现......当请求到达时
发布 /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>
如果这是不可能的,你建议什么解决方法?