diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-02-17 14:44:57 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-03-06 15:41:25 +0100 |
commit | 9cc0ff8f468c54e23172492d97f6d9b428d3ad2e (patch) | |
tree | 5de31ec4dea0df354cc246b809dff5ef376316d5 /lib | |
parent | 80fbced2e0b8d291173e1002f150bc5551e87359 (diff) | |
download | gitlab-ce-9cc0ff8f468c54e23172492d97f6d9b428d3ad2e.tar.gz |
Cleanup common code in Unique Ips tests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/api.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/auth/unique_ips_limiter.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 6f37fa9d8e9..efbb56ecd2c 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -61,7 +61,7 @@ module API end rescue_from Gitlab::Auth::TooManyIps do |e| - rack_response({'message'=>'403 Forbidden'}.to_json, 403) + rack_response({ 'message' => '403 Forbidden' }.to_json, 403) end rescue_from :all do |exception| diff --git a/lib/gitlab/auth/unique_ips_limiter.rb b/lib/gitlab/auth/unique_ips_limiter.rb index 7f849ef4c38..4b2b758be8a 100644 --- a/lib/gitlab/auth/unique_ips_limiter.rb +++ b/lib/gitlab/auth/unique_ips_limiter.rb @@ -27,7 +27,7 @@ module Gitlab end def limit_user!(user = nil) - user = yield if user.nil? + user = yield if user.nil? && block_given? limit_user_id!(user.id) unless user.nil? user end |