about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-30 19:04:39 +0100
committerGitHub <noreply@github.com>2022-10-30 19:04:39 +0100
commita529d6d93e777003019f1ab0d7ff913134625cf6 (patch)
tree7883582c73552b8c792f88658d73866ecf6e32ae
parentac9fb0d654440ce1179bab4071941450aa994d2c (diff)
Fix invites (#19560)
Fixes #19507

Fix regression from #19296
-rw-r--r--app/controllers/auth/registrations_controller.rb1
-rw-r--r--app/views/auth/registrations/rules.html.haml3
2 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb
index 84a802447..14e0d9a36 100644
--- a/app/controllers/auth/registrations_controller.rb
+++ b/app/controllers/auth/registrations_controller.rb
@@ -148,6 +148,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
     return if @rules.empty? || (session[:accept_token].present? && params[:accept] == session[:accept_token])
 
     @accept_token = session[:accept_token] = SecureRandom.hex
+    @invite_code  = invite_code
 
     set_locale { render :rules }
   end
diff --git a/app/views/auth/registrations/rules.html.haml b/app/views/auth/registrations/rules.html.haml
index a41581b32..8e7a90cbe 100644
--- a/app/views/auth/registrations/rules.html.haml
+++ b/app/views/auth/registrations/rules.html.haml
@@ -14,7 +14,8 @@
         .rules-list__text= rule.text
 
   .stacked-actions
-    = link_to t('auth.rules.accept'), new_user_registration_path(accept: @accept_token), class: 'button'
+    - accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token)
+    = link_to t('auth.rules.accept'), accept_path, class: 'button'
     = link_to t('auth.rules.back'), root_path, class: 'button button-tertiary'
 
 .form-footer= render 'auth/shared/links'