mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 13:19:19 +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>
27 lines
532 B
Ruby
Vendored
27 lines
532 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module DiscourseCaptcha
|
|
class CaptchaController < ::ApplicationController
|
|
requires_plugin PLUGIN_NAME
|
|
|
|
before_action :ensure_config
|
|
skip_before_action :redirect_to_login_if_required
|
|
|
|
TOKEN_TTL = 2.minutes
|
|
|
|
def create
|
|
server_session.set(token_key, params[:token], expires: TOKEN_TTL)
|
|
render json: { success: "OK" }
|
|
end
|
|
|
|
private
|
|
|
|
def ensure_config
|
|
raise NotImplementedError
|
|
end
|
|
|
|
def token_key
|
|
raise NotImplementedError
|
|
end
|
|
end
|
|
end
|