Skip to content

Commit 1178fd8

Browse files
authored
Made the minimum recaptcha score configurable (#1660)
1 parent ceeeafd commit 1178fd8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

config/initializers/recaptcha.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ def recaptcha_with_disclaimer_and_fallback(action:, **options)
3737
end
3838

3939
module RecaptchaController
40-
MINIMUM_SCORE = 0.2
41-
4240
def self.included(base)
4341
base.helper RecaptchaView
4442
end
@@ -50,7 +48,7 @@ def verify_recaptcha_with_fallback(**options)
5048

5149
options = {
5250
action: action_name,
53-
minimum_score: MINIMUM_SCORE,
51+
minimum_score: Settings::Db.store.minimum_recaptcha_score,
5452
**options
5553
}
5654

config/locales/en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ en:
434434
number_of_days_contacts_modified:
435435
name: Contacts modified in last x days
436436
help_block: Retrieve contacts modified in the last X days in update_user_salesforce_info
437+
minimum_recaptcha_score:
438+
name: Minimum reCAPTCHA score allowed to register a new account
439+
help_block: Humans should score closer to 1, bots should score closer to 0
437440

438441
layouts:
439442
application_footer:

lib/settings.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class Store < RailsSettings::Base
142142
field :sheer_id_base_url,
143143
type: :string, default: 'https://offers.sheerid.com/openstax/staging/teacher/?env=dev'
144144
field :number_of_days_contacts_modified, type: :integer, default: 7
145+
field :minimum_recaptcha_score, type: :float, default: 0.2
145146
end
146147

147148
mattr_accessor :store

0 commit comments

Comments
 (0)