diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-03-03 18:10:22 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-03-06 15:45:43 +0100 |
commit | 70b9d8da4c24bc2317220bedb81b5d2ecf34c351 (patch) | |
tree | fec5179bcb418d981340435bcb70f7f22efb6747 /lib/gitlab/auth | |
parent | 8a9bc24ef87739580c19ee8455bd8224d3c18b3e (diff) | |
download | gitlab-ce-70b9d8da4c24bc2317220bedb81b5d2ecf34c351.tar.gz |
Remove unecessary defaults for uniq ip block, cleanup refactoring leftovers
Diffstat (limited to 'lib/gitlab/auth')
-rw-r--r-- | lib/gitlab/auth/unique_ips_limiter.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/auth/unique_ips_limiter.rb b/lib/gitlab/auth/unique_ips_limiter.rb index 4d401eb1b5d..bf2239ca150 100644 --- a/lib/gitlab/auth/unique_ips_limiter.rb +++ b/lib/gitlab/auth/unique_ips_limiter.rb @@ -8,12 +8,13 @@ module Gitlab if config.unique_ips_limit_enabled ip = RequestContext.client_ip unique_ips = update_and_return_ips_count(user_id, ip) + raise TooManyIps.new(user_id, ip, unique_ips) if unique_ips > config.unique_ips_limit_per_user end end def limit_user!(user = nil) - user = yield if user.nil? && block_given? + user ||= yield if block_given? limit_user_id!(user.id) unless user.nil? user end |