Skip to content

Conversation

@rsmithlal
Copy link
Member

This pull request introduces extensible support for CAPTCHA validation in the user registration flow, allowing host applications to add custom security checks (such as Turnstile or reCAPTCHA) without modifying the core codebase. The changes include new hook methods in the controller, updates to the registration view for easy extension, and improved error messaging with localization.

Extensibility for CAPTCHA Validation

  • Added validate_captcha_if_enabled and handle_captcha_validation_failure hook methods to BetterTogether::Users::RegistrationsController, allowing host apps to implement and customize CAPTCHA logic and error handling. Default implementations are provided and can be overridden.
  • Updated the registration controller to call CAPTCHA validation before creating a user, and to handle validation failures gracefully.

View and Form Extensibility

  • Added a partial _extra_registration_fields.html.erb with guidance for host apps to add custom registration fields (e.g., CAPTCHA), and rendered this partial in the registration form. [1] [2]

Localization and Error Messaging

  • Added captcha_validation_failed error message to English, Spanish, and French locale files for improved user feedback on CAPTCHA failures. [1] [2] [3]

Testing

  • Added controller specs to verify the default behavior of the new CAPTCHA hook methods, ensuring extensibility and reliability.

@rsmithlal rsmithlal marked this pull request as ready for review October 29, 2025 15:42
@rsmithlal rsmithlal merged commit 4ad463c into main Oct 29, 2025
11 of 12 checks passed
@rsmithlal rsmithlal deleted the feat/turnstile branch October 29, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants