summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-01-20 14:24:20 -0500
committerRobert Speicher <rspeicher@gmail.com>2016-01-20 14:25:40 -0500
commit6a5cd3ca41f61a188b221e6436e9a0d06c0484f2 (patch)
treeafb19b02929a5e762bd5141f003e3a360cf043fa /app
parent96f12f57fc4041add82aaf13f61ca22f0bcd5392 (diff)
downloadgitlab-ce-6a5cd3ca41f61a188b221e6436e9a0d06c0484f2.tar.gz
Merge branch 'feature/check-against-rbl-only' into 'master'
Split from !2455 References #9092 See merge request !2515
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/application_settings_controller.rb2
-rw-r--r--app/controllers/registrations_controller.rb5
-rw-r--r--app/models/application_setting.rb2
-rw-r--r--app/views/admin/application_settings/_form.html.haml16
4 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index 9943745208e..094eef28a43 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -74,6 +74,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:metrics_timeout,
:metrics_method_call_threshold,
:metrics_sample_interval,
+ :ip_blocking_enabled,
+ :dnsbl_servers_list,
:recaptcha_enabled,
:recaptcha_site_key,
:recaptcha_private_key,
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index c48175a4c5a..5efdd613e79 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -8,6 +8,11 @@ class RegistrationsController < Devise::RegistrationsController
def create
if !Gitlab::Recaptcha.load_configurations! || verify_recaptcha
+ if Gitlab::IpCheck.new(request.remote_ip).spam?
+ flash[:alert] = 'Could not create an account. This IP is listed for spam.'
+ return render action: 'new'
+ end
+
super
else
flash[:alert] = "There was an error with the reCAPTCHA code below. Please re-enter the code."
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 59563b8823c..2f3487b53ac 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -43,6 +43,8 @@
# metrics_port :integer default(8089)
# sentry_enabled :boolean default(FALSE)
# sentry_dsn :string
+# ip_blocking_enabled :boolean default(FALSE)
+# dns_blacklist_threshold :float default(0.33)
#
class ApplicationSetting < ActiveRecord::Base
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
index 35e4dd761ab..c4020c8273b 100644
--- a/app/views/admin/application_settings/_form.html.haml
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -215,6 +215,22 @@
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
+ = f.label :ip_blocking_enabled do
+ = f.check_box :ip_blocking_enabled
+ Enable IP check against blacklist at sign-up
+ .help-block Helps preventing accounts creation from 'known spam sources'
+
+ .form-group
+ = f.label :dnsbl_servers_list, class: 'control-label col-sm-2' do
+ DNSBL servers list
+ .col-sm-10
+ = f.text_field :dnsbl_servers_list, class: 'form-control'
+ .help-block
+ Please enter DNSBL servers separated with comma
+
+ .form-group
+ .col-sm-offset-2.col-sm-10
+ .checkbox
= f.label :recaptcha_enabled do
= f.check_box :recaptcha_enabled
Enable reCAPTCHA