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

Honeypot on users sign up form #1772

Merged
merged 1 commit into from
Dec 21, 2018
Merged
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
2 changes: 1 addition & 1 deletion app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy, :finish_signup, :do_finish_signup]
before_filter :configure_permitted_parameters

invisible_captcha only: [:create], honeypot: :family_name, scope: :user
invisible_captcha only: [:create], honeypot: :address, scope: :user

def new
super do |user|
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
label: false,
aria: {describedby: "username-help-text"} %>

<%= f.invisible_captcha :family_name %>
<%= f.invisible_captcha :address %>

<%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %>

Expand Down
4 changes: 2 additions & 2 deletions spec/features/registration_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
visit new_user_registration_path

fill_in 'user_username', with: "robot"
fill_in 'user_family_name', with: 'This is the honeypot field'
fill_in 'user_address', with: 'This is the honeypot field'
fill_in 'user_email', with: 'robot@robot.com'
fill_in 'user_password', with: 'destroyallhumans'
fill_in 'user_password_confirmation', with: 'destroyallhumans'
Expand All @@ -65,7 +65,7 @@
visit new_user_registration_path

fill_in 'user_username', with: "robot"
fill_in 'user_family_name', with: 'This is the honeypot field'
fill_in 'user_address', with: 'This is the honeypot field'
fill_in 'user_email', with: 'robot@robot.com'
fill_in 'user_password', with: 'destroyallhumans'
fill_in 'user_password_confirmation', with: 'destroyallhumans'
Expand Down