From e0fc0858a19c7bb25d25b9c4077e58500839448d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 9 Jun 2026 11:39:24 -0400 Subject: [PATCH] Use http POST on rules acceptance button during registration (#39345) --- app/controllers/auth/acceptances_controller.rb | 13 +++++++++++++ app/views/auth/registrations/rules.html.haml | 2 +- config/routes.rb | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/controllers/auth/acceptances_controller.rb diff --git a/app/controllers/auth/acceptances_controller.rb b/app/controllers/auth/acceptances_controller.rb new file mode 100644 index 0000000000..ba03a327e7 --- /dev/null +++ b/app/controllers/auth/acceptances_controller.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class Auth::AcceptancesController < ApplicationController + def create + redirect_to new_user_registration_path(registration_params) + end + + private + + def registration_params + params.permit(:accept, :invite_code).compact_blank + end +end diff --git a/app/views/auth/registrations/rules.html.haml b/app/views/auth/registrations/rules.html.haml index 69b42b993f..961b1b1e1b 100644 --- a/app/views/auth/registrations/rules.html.haml +++ b/app/views/auth/registrations/rules.html.haml @@ -4,7 +4,7 @@ - content_for :header_tags do = render partial: 'shared/og', locals: { description: description_for_sign_up(@invite) } -= form_with class: :simple_form, method: :get, url: new_user_registration_path do |form| += form_with class: :simple_form, url: auth_acceptance_path do |form| = render 'auth/shared/progress', stage: 'rules' - if @invite.present? && @invite.autofollow? diff --git a/config/routes.rb b/config/routes.rb index 8538635124..ca5a9a2fb9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,6 +74,7 @@ Rails.application.routes.draw do resource :unsubscribe, only: [:show, :create], controller: :unsubscriptions namespace :auth do + resource :acceptance, only: [:create] resource :setup, only: [:show, :update], controller: :setup resource :challenge, only: [:create] post 'captcha_confirmation', to: 'confirmations#confirm_captcha', as: :captcha_confirmation