- <%= check_box_tag :terms_of_service_agreement, '1', false, class: 'form-check-input agreement-checkbox', data: { agreement_identifier: 'terms_of_service' }, required: true, aria: { describedby: 'terms-of-service-summary', disabled: 'true' } %>
- <%= label_tag :terms_of_service_agreement, t('.terms_of_service.label'), class: 'form-check-label' %>
+
- <%= check_box_tag :privacy_policy_agreement, '1', false, class: 'form-check-input agreement-checkbox', data: { agreement_identifier: 'privacy_policy' }, required: true, aria: { describedby: 'privacy-policy-summary', disabled: 'true' } %>
- <%= label_tag :privacy_policy_agreement, t('.privacy_policy.label'), class: 'form-check-label' %>
+
<% end %>
<% if @code_of_conduct_agreement %>
-
<% end %>
+
+ <%= render partial: 'devise/registrations/extra_registration_fields', locals: { form: f, resource: resource } %>
+
-
- <%= f.submit t('.sign_up'), class: 'btn btn-primary' %>
+
+ <%= f.submit t('.sign_up'), class: 'btn btn-primary', id: 'registration-submit-btn' %>
- <%= render "devise/shared/links" %>
+
+ <%= render "devise/shared/links" %>
+
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 64effabb7..6a49a1955 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1418,6 +1418,8 @@ en:
updated_on_short: Updated
view_post: View Post
primary: Primary
+ registrations:
+ captcha_validation_failed: Security verification failed. Please try again.
remove: Remove
resource_permissions:
index:
@@ -1721,6 +1723,8 @@ en:
agreements_must_accept: You must accept the Terms of Service and Privacy Policy
to continue.
agreements_required: You must accept the Privacy Policy and Terms of Service
+ captcha_validation_failed: Security verification failed. Please complete the
+ security check and try again.
code_of_conduct:
label: I agree to the Code of Conduct
email:
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 671f420b3..31edccb05 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -1428,6 +1428,9 @@ es:
updated_on_short: Actualizado
view_post: Ver publicación
primary: Primario
+ registrations:
+ captcha_validation_failed: La verificación de seguridad falló. Por favor, inténtelo
+ de nuevo.
remove: Eliminar
resource_permissions:
index:
@@ -1732,13 +1735,16 @@ es:
actual para confirmar los cambios
new:
agreements:
- privacy_policy: I agree to the Privacy Policy
- terms_of_service: I agree to the Terms of Service
- agreements_must_accept: You must accept the Terms of Service and Privacy Policy
- to continue.
- agreements_required: You must accept the Privacy Policy and Terms of Service
+ privacy_policy: Acepto la Política de Privacidad
+ terms_of_service: Acepto los Términos de Servicio
+ agreements_must_accept: Debe aceptar los Términos de Servicio y la Política
+ de Privacidad para continuar.
+ agreements_required: Debe aceptar la Política de Privacidad y los Términos
+ de Servicio
+ captcha_validation_failed: La verificación de seguridad falló. Por favor,
+ completa la verificación de seguridad e inténtalo de nuevo.
code_of_conduct:
- label: I agree to the Code of Conduct
+ label: Acepto el Código de Conducta
email:
help: Por favor, introduzca una dirección de correo válida.
label: Correo Electrónico
@@ -1764,13 +1770,13 @@ es:
name: Nombre
name_hint: Por favor, proporcione su nombre completo.
privacy_policy:
- label: I agree to the Privacy Policy
+ label: Acepto la Política de Privacidad
profile_details: Detalles del Perfil
sign_up: Registrarse
submit: Enviar
terms_of_service:
- label: I agree to the Terms of Service
- view: View
+ label: Acepto los Términos de Servicio
+ view: Ver
signed_up: Bienvenido. Tu cuenta fue creada.
signed_up_but_inactive: Tu cuenta ha sido creada correctamente. Sin embargo,
no hemos podido iniciar la sesión porque tu cuenta aún no está activada.
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 5a0705485..60a48b25e 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -1435,6 +1435,8 @@ fr:
updated_on_short: Mis à jour
view_post: Voir la publication
primary: Principal
+ registrations:
+ captcha_validation_failed: La vérification de sécurité a échoué. Veuillez réessayer.
remove: Supprimer
resource_permissions:
index:
@@ -1740,13 +1742,16 @@ fr:
votre mot de passe actuel pour valider ces modifications
new:
agreements:
- privacy_policy: I agree to the Privacy Policy
- terms_of_service: I agree to the Terms of Service
- agreements_must_accept: You must accept the Terms of Service and Privacy Policy
- to continue.
- agreements_required: You must accept the Privacy Policy and Terms of Service
+ privacy_policy: J'accepte la Politique de Confidentialité
+ terms_of_service: J'accepte les Conditions d'Utilisation
+ agreements_must_accept: Vous devez accepter les Conditions d'Utilisation et
+ la Politique de Confidentialité pour continuer.
+ agreements_required: Vous devez accepter la Politique de Confidentialité et
+ les Conditions d'Utilisation
+ captcha_validation_failed: La vérification de sécurité a échoué. Veuillez
+ compléter la vérification de sécurité et réessayer.
code_of_conduct:
- label: I agree to the Code of Conduct
+ label: J'accepte le Code de Conduite
email:
help: Veuillez entrer une adresse email valide.
label: Email
@@ -1772,13 +1777,13 @@ fr:
name: Nom
name_hint: Veuillez fournir votre nom complet.
privacy_policy:
- label: I agree to the Privacy Policy
+ label: J'accepte la Politique de Confidentialité
profile_details: Détails du Profil
sign_up: Inscription
submit: Soumettre
terms_of_service:
- label: I agree to the Terms of Service
- view: View
+ label: J'accepte les Conditions d'Utilisation
+ view: Voir
signed_up: Bienvenue ! Vous vous êtes bien enregistré(e).
signed_up_but_inactive: Vous vous êtes bien enregistré(e). Cependant, nous n’avons
pas pu vous connecter car votre compte n’a pas encore été activé.
diff --git a/spec/controllers/better_together/users/registrations_controller_hook_spec.rb b/spec/controllers/better_together/users/registrations_controller_hook_spec.rb
new file mode 100644
index 000000000..e62d8039d
--- /dev/null
+++ b/spec/controllers/better_together/users/registrations_controller_hook_spec.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe BetterTogether::Users::RegistrationsController, :skip_host_setup do
+ include BetterTogether::CapybaraFeatureHelpers
+
+ routes { BetterTogether::Engine.routes }
+
+ before do
+ configure_host_platform
+ end
+
+ describe 'captcha hook methods', :no_auth do
+ describe '#validate_captcha_if_enabled?' do
+ let(:controller_instance) { described_class.new }
+
+ it 'returns true by default (no captcha validation)' do
+ expect(controller_instance.send(:validate_captcha_if_enabled?)).to be true
+ end
+ end
+
+ describe '#handle_captcha_validation_failure' do
+ let(:user) { build(:better_together_user) }
+ let(:controller_instance) { described_class.new }
+
+ before do
+ allow(controller_instance).to receive(:respond_with)
+ end
+
+ it 'adds error to resource and calls respond_with' do
+ controller_instance.send(:handle_captcha_validation_failure, user)
+
+ expect(user.errors[:base]).to include('Security verification failed. Please try again.')
+ expect(controller_instance).to have_received(:respond_with).with(user)
+ end
+ end
+ end
+
+ # Integration test for the complete captcha flow will be handled in feature specs
+end