通过Email重置密码人机校验发生错误

Summary

使用email进行重置密码时,人机校验显示发生错误。

原因追溯: #2049 (closed) 部分代码 在 !1232 (merged) 中合入,但是在此 issue 未被解决的情况下进入到了 production。

而此处写死的字段tencent_captcha_response!1258 (merged) 合入后已经失效变为 jh_captcha_response,因此发生后端报错。

更根本的原因在于此处人机校验方式本来由haml 中的 recaptcha_tags 变为了由于此页面的重构到vue中变为了前端主动调用,人机校验的渲染策略在后端被跳过(short circuit)。

Steps to reproduce

  1. 进入重置密码页。
  2. 使用email重置密码

Example Project

What is the current bug behavior?

人机校验错误

What is the expected correct behavior?

人机校验正确

Relevant logs and/or screenshots

image

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

当前的修复策略:

修改 jh/app/assets/javascripts/passwords/components/email_form.vue 中写死的input 为 .js-captcha 锚点,此时可以兼容 极验和腾讯两种模式,但是仍然存在上述提到的短路问题:

  1. 无法支持 google reCAPTCHA(即使已经在SaaS我们已经放弃此服务,但我们仍旧支持随时回退到此服务)
  2. 后台没打开人机校验的情况下仍然会渲染人机校验(但此时无论用户是否人机验证,后端对于此请求都不会进行校验,可以顺利提交)。

建议后续对此页面进行重构,改回 haml,并使用 js 的方式完成交互

Kun Qian 编辑于