-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1770 from DFE-Digital/feedback-captcha
Add invisible captcha protection to candidates feedback form
- Loading branch information
Showing
6 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ | |
</p> | ||
<% end %> | ||
|
||
<%= invisible_captcha %> | ||
|
||
<%= f.submit 'Submit feedback' %> | ||
<% end %> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
InvisibleCaptcha.setup do |config| | ||
# Only enable in production so our automated integration | ||
# tests don't fail. | ||
config.timestamp_enabled = Rails.env.production? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature "Feedback", type: :feature do | ||
scenario "a bot submitting feedback (filling in the honeypot)" do | ||
visit new_candidates_feedback_path | ||
|
||
choose "Make a school experience request" | ||
choose "Yes" | ||
choose "Satisfied" | ||
fill_in "If you are a human, ignore this field", with: "i-am-a-bot" | ||
|
||
click_on "Submit feedback" | ||
|
||
expect(page.status_code).to eq(200) | ||
expect(page.body).to eq("") | ||
end | ||
end |