]> cat aescling's git repositories - mastodon.git/commit
Add optional hCaptcha support
authorClaire <claire.github-309c@sitedethib.com>
Mon, 24 Jan 2022 18:06:19 +0000 (19:06 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Mon, 24 Jan 2022 20:22:13 +0000 (21:22 +0100)
commit1b493c9fee954b5bd4c4b00f9f945a5d97e2d699
tree902087cb4c658f83570db7aa7ae08d324e1a94ef
parente58e0eb9aa375b1107b207e8229a2142c4edc0b8
Add optional hCaptcha support

Fixes #1649

This requires setting `HCAPTCHA_SECRET_KEY` and `HCAPTCHA_SITE_KEY`, then
enabling the admin setting at
`/admin/settings/edit#form_admin_settings_captcha_enabled`

Subsequently, a hCaptcha widget will be displayed on `/about` and
`/auth/sign_up` unless:
- the user is already signed-up already
- the user has used an invite link
- the user has already solved the captcha (and registration failed for another
  reason)

The Content-Security-Policy headers are altered automatically to allow the
third-party hCaptcha scripts on `/about` and `/auth/sign_up` following the same
rules as above.
15 files changed:
.env.production.sample
Gemfile
Gemfile.lock
app/controllers/about_controller.rb
app/controllers/api/v1/accounts_controller.rb
app/controllers/auth/registrations_controller.rb
app/controllers/concerns/captcha_concern.rb [new file with mode: 0644]
app/helpers/admin/settings_helper.rb
app/javascript/flavours/glitch/styles/forms.scss
app/models/form/admin_settings.rb
app/views/about/_registration.html.haml
app/views/admin/settings/edit.html.haml
app/views/auth/registrations/new.html.haml
config/locales-glitch/en.yml
config/settings.yml