Skip to content

Commit

Permalink
add invisible recaptcha to form
Browse files Browse the repository at this point in the history
  • Loading branch information
Dujota committed Jan 11, 2022
1 parent 7af828a commit 5fa7255
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ gem "letter_opener", group: :development
# Auth
gem "devise", "~> 4.8"
gem "cancancan", "~> 3.2"

# Anti Spam
gem 'invisible_captcha'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ GEM
activesupport (>= 5.0)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
invisible_captcha (2.0.0)
rails (>= 5.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -270,6 +272,7 @@ DEPENDENCIES
devise (~> 4.8)
dotenv-rails
factory_bot_rails (~> 6.2)
invisible_captcha
jbuilder (~> 2.7)
letter_opener
listen (~> 3.3)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/inquiries_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class InquiriesController < ApplicationController
invisible_captcha only: [:create]
skip_before_action :verify_authenticity_token
load_and_authorize_resource

Expand Down
2 changes: 2 additions & 0 deletions app/views/inquiries/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<% end %>
<%# Contact Form %>
<%= form_with model: @inquiry, url: inquiries_path, class: "resource-form" do |f| %>
<%= invisible_captcha %>

<fieldset>
<%= f.label :name do %>
Full Name <strong>*</strong>
Expand Down

0 comments on commit 5fa7255

Please sign in to comment.