Skip to content

Resolve Tencent captcha failed

What does this MR do and why?

Bug 原因:腾讯验证码 API response 中 CaptchaMsg 的值从 OK 变成了 ok.

目前的判断逻辑 res.CaptchaMsg == "OK" tencent_captcha.rb#L41

根据下面API的调试信息和对应的SDK源码 以及核查验证码票据结果(Web及APP) 可以得到一个结论 CaptchaCode 等于 1 代表验证码验证通过。

验证码被解决的API返回

#<TencentCloud::Captcha::V20190722::DescribeCaptchaResultResponse:0x000000016214f740 @CaptchaCode=1, @CaptchaMsg="ok", @EvilLevel=0, @GetCaptchaTime=0, @RequestId="7bdbc1d0-6585-4c75-9974-3f7f829dd171">

验证码超时的API返回

#<TencentCloud::Captcha::V20190722::DescribeCaptchaResultResponse:0x000000016f76f488 @CaptchaCode=8, @CaptchaMsg="ticket expired 详情请参考:腾讯云-天御验证码-产品文档,搜索关键字“DescribeCaptchaResult”,查看输出参数中CaptchaCode字段的具体描述", @EvilLevel=0, @GetCaptchaTime=0, @RequestId="75fb4d62-0995-4b08-8bf1-8eb215aa69f8">

Random Str不匹配的API返回

#<TencentCloud::Captcha::V20190722::DescribeCaptchaResultResponse:0x000000013ba97a18 @CaptchaCode=7, @CaptchaMsg="captcha no match 详情请参考:腾讯云-天御验证码-产品文档,搜索关键字“DescribeCaptchaResult”,查看输出参数中CaptchaCode字段的具体描述", @EvilLevel=0, @GetCaptchaTime=0, @RequestId="44ac2226-0ba2-4d5e-8855-4e5607d158a0">
  • log api response
  • use CaptchaCode to check whether captcha is solved

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #1327 (closed)

Martin Tan 编辑于

合并请求报告

加载中