Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add invisible_captcha to user registration #333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bullet_train/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PATH
hiredis
http_accept_language
image_processing
invisible_captcha
microscope
nice_partials (~> 0.9)
pagy
Expand Down Expand Up @@ -202,6 +203,8 @@ GEM
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
invisible_captcha (2.1.0)
rails (>= 5.2)
json (2.6.3)
language_server-protocol (3.17.0.2)
loofah (2.20.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Registrations::ControllerBase
extend ActiveSupport::Concern

included do
invisible_captcha only: :create

def new
# We have to set the session here because Safari wouldn't save it on a redirect to this URL.
if params[:invitation_uuid]
Expand Down
2 changes: 2 additions & 0 deletions bullet_train/app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<%= render 'account/shared/notices' %>
<%= render 'account/shared/forms/errors', form: f %>

<%= invisible_captcha %>

<%= render 'shared/fields/email_field', form: f, method: :email, options: {autofocus: true} do %>
<% content_for :help do %>
<%= link_to t('devise.links.have_account'), new_user_session_path %>
Expand Down
3 changes: 3 additions & 0 deletions bullet_train/bullet_train.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ Gem::Specification.new do |spec|

# Password strength.
spec.add_dependency "devise-pwned_password"

# Captcha
spec.add_dependency "invisible_captcha"
end
6 changes: 6 additions & 0 deletions bullet_train/lib/bullet_train/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
rescue LoadError
end

begin
# And the same holds true for invisible_captcha
require "invisible_captcha"
kaspth marked this conversation as resolved.
Show resolved Hide resolved
rescue LoadError
end

module BulletTrain
class Engine < ::Rails::Engine
end
Expand Down