Compare commits

...

5 Commits

Author SHA1 Message Date
Matt Jankowski
d6c744d557
Merge a2241da91a into 624c024766 2025-09-03 10:07:13 +00:00
Matt Jankowski
a2241da91a i-var group together 2025-08-27 14:21:43 -04:00
Matt Jankowski
0d5a72aef5 Method to check accept token value 2025-08-27 14:21:43 -04:00
Matt Jankowski
84f5bb5ac0 Remove double call to set_locale 2025-08-27 14:21:43 -04:00
Matt Jankowski
e6a6a74882 Use partial for rule translation loop during registration 2025-08-27 14:21:43 -04:00
3 changed files with 13 additions and 9 deletions

View File

@ -130,12 +130,17 @@ class Auth::RegistrationsController < Devise::RegistrationsController
end
def require_rules_acceptance!
return if @rules.empty? || (session[:accept_token].present? && params[:accept] == session[:accept_token])
return if @rules.empty? || validated_accept_token?
@accept_token = session[:accept_token] = SecureRandom.hex
@invite_code = invite_code
@invite_code = invite_code
@rule_translations = @rules.map { |rule| rule.translation_for(I18n.locale) }
set_locale { render :rules }
render :rules
end
def validated_accept_token?
session[:accept_token].present? && params[:accept] == session[:accept_token]
end
def is_flashing_format? # rubocop:disable Naming/PredicatePrefix

View File

@ -17,12 +17,7 @@
%p.lead= t('auth.rules.preamble', domain: site_hostname)
%ol.rules-list
- @rules.each do |rule|
- translation = rule.translation_for(I18n.locale.to_s)
%li
%button{ type: 'button', aria: { expanded: 'false' } }
.rules-list__text= translation.text
.rules-list__hint= translation.hint
= render @rule_translations
.stacked-actions
- accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token)

View File

@ -0,0 +1,4 @@
%li
%button{ type: 'button', aria: { expanded: 'false' } }
.rules-list__text= rule_translation.text
.rules-list__hint= rule_translation.hint