mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:39:43 +08:00
#### Description:
This PR renames the `discourse-hcaptcha` plugin to `discourse-captcha`
to better reflect its support for multiple captcha providers (hCaptcha
and reCAPTCHA)
#### Changes
- Renamed plugin directory from plugins/discourse-hcaptcha to
plugins/discourse-captcha
- Updated Ruby module namespace from DiscourseHcaptcha to
DiscourseCaptcha
- Updated references in:
- .gitignore
- pnpm-workspace.yaml
- tsconfig.json
- config/official_plugins.json
- translator.yml
- migrations/core/config/intermediate_db.yml
- `hosted-site` plugin
- Migration file preserved to handle existing discourse_hcaptcha_enabled
setting migration
---------
Co-authored-by: Gabriel Grubba <gabriel@discourse.org>
21 lines
580 B
Ruby
Vendored
21 lines
580 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module DiscourseCaptcha
|
|
class RecaptchaProvider < CaptchaProvider
|
|
CAPTCHA_VERIFICATION_URL = "https://www.google.com/recaptcha/api/siteverify"
|
|
|
|
def fetch_captcha_token(server_session)
|
|
token = server_session["recaptcha_token"]
|
|
server_session.delete("recaptcha_token")
|
|
token
|
|
end
|
|
|
|
def captcha_verification_url
|
|
CAPTCHA_VERIFICATION_URL
|
|
end
|
|
|
|
def send_captcha_verification(captcha_token)
|
|
send_verification(captcha_token, CAPTCHA_VERIFICATION_URL, SiteSetting.recaptcha_secret_key)
|
|
end
|
|
end
|
|
end
|