Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Load and execute recaptcha
Browse files Browse the repository at this point in the history
  • Loading branch information
osahyoun committed Sep 4, 2019
1 parent 218f41c commit 100342f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Expand Up @@ -181,7 +181,7 @@ def search_params
end

def process_one_click
@process_one_click ||= PaymentProcessor::Braintree::OneClickFromUri.new(
@process_one_click ||= ::PaymentProcessor::Braintree::OneClickFromUri.new(
params.to_unsafe_hash,
page: @page,
member: recognized_member,
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/member_facing.slim
Expand Up @@ -19,6 +19,7 @@ html lang="#{@page.language.try(:code).try(:downcase)}"
= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.2/rails.min.js'
= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'
= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js'
= javascript_include_tag "https://www.google.com/recaptcha/api.js?render=#{Settings.recaptcha3.site_key}"

= javascript_packs_with_chunks_tag "sentry"

Expand All @@ -45,3 +46,4 @@ html lang="#{@page.language.try(:code).try(:downcase)}"

= render partial: "shared/google_analytics_snippet"
= render partial: "shared/shareprogress_snippet"
= render partial: "shared/recaptcha_snippet" unless Rails.env.testing?
7 changes: 7 additions & 0 deletions app/views/shared/_recaptcha_snippet.slim
@@ -0,0 +1,7 @@
javascript:
grecaptcha.ready(function() {
grecaptcha.execute("#{Settings.recaptcha3.site_key}", {action: "#{request.path}"}).
then(function(token) {
console.log(token); // put token somewhere to be later sent down the wire
});
});

0 comments on commit 100342f

Please sign in to comment.