Skip to content

Commit

Permalink
Merge pull request #458 from taylor-steve/input-inline-script
Browse files Browse the repository at this point in the history
Remove inline_script attribute from markup
  • Loading branch information
grosser authored Nov 27, 2024
2 parents 8e5ccae + ebc4d8c commit a13b9e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/recaptcha/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def self.to_message(_key, default)
skip_script = (options.delete(:script) == false) || (options.delete(:external_script) == false)
ui = options.delete(:ui)
options.delete(:ignore_no_element)
options.delete(:inline_script)

data_attribute_keys = [:badge, :theme, :type, :callback, :expired_callback, :error_callback, :size]
data_attribute_keys << :tabindex unless ui == :button
Expand Down
7 changes: 7 additions & 0 deletions test/client_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,12 @@
output = recaptcha_v3(action: 'foo', ignore_no_element: false)
refute_includes output, 'if (element !== null)'
end

it 'does not output an inline script attribute' do
output = recaptcha_v3(action: 'foo', inline_script: true)
refute_includes output, 'inline_script'
output = recaptcha_v3(action: 'foo', inline_script: false)
refute_includes output, 'inline_script'
end
end
end

0 comments on commit a13b9e0

Please sign in to comment.