summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-02-17 14:04:10 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2017-03-06 15:41:25 +0100
commit80fbced2e0b8d291173e1002f150bc5551e87359 (patch)
treea01252328c2d7efd095d92d7c48022fbfc244e14 /app
parent5173c0939386b8fbf4632d755849bcafc863872e (diff)
downloadgitlab-ce-80fbced2e0b8d291173e1002f150bc5551e87359.tar.gz
Add admin settings entries
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/application_settings_controller.rb3
-rw-r--r--app/models/application_setting.rb10
-rw-r--r--app/views/admin/application_settings/_form.html.haml22
3 files changed, 35 insertions, 0 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index d807e6263ee..8d831ffdd70 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -138,6 +138,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:two_factor_grace_period,
:user_default_external,
:user_oauth_applications,
+ :unique_ips_limit_per_user,
+ :unique_ips_limit_time_window,
+ :unique_ips_limit_enabled,
:version_check_enabled,
:terminal_max_session_time,
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 2f64fb1a6a2..be632930895 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -64,6 +64,16 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
if: :akismet_enabled
+ validates :unique_ips_limit_per_user,
+ numericality: { greater_than_or_equal_to: 1 },
+ presence: true,
+ if: :unique_ips_limit_enabled
+
+ validates :unique_ips_limit_time_window,
+ numericality: { greater_than_or_equal_to: 0 },
+ presence: true,
+ if: :unique_ips_limit_enabled
+
validates :koding_url,
presence: true,
if: :koding_enabled
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
index 057b584e1bc..7f25f76d0cb 100644
--- a/app/views/admin/application_settings/_form.html.haml
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -360,6 +360,28 @@
Generate API key at
%a{ href: 'http://www.akismet.com', target: 'blank' } http://www.akismet.com
+ .form-group
+ .col-sm-offset-2.col-sm-10
+ .checkbox
+ = f.label :unique_ips_limit_enabled do
+ = f.check_box :unique_ips_limit_enabled
+ Limit sign in from multiple ips
+ %span.help-block#recaptcha_help_block Helps prevent malicious users hide their activity
+
+ .form-group
+ = f.label :unique_ips_limit_per_user, 'IPs per user', class: 'control-label col-sm-2'
+ .col-sm-10
+ = f.number_field :unique_ips_limit_per_user, class: 'form-control'
+ .help-block
+ Maximum number of unique IPs per user
+
+ .form-group
+ = f.label :unique_ips_limit_time_window, 'IP expiration time', class: 'control-label col-sm-2'
+ .col-sm-10
+ = f.number_field :unique_ips_limit_time_window, class: 'form-control'
+ .help-block
+ How long an IP will be counted towards the limit
+
%fieldset
%legend Abuse reports
.form-group