diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-06 16:22:46 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-06 16:22:46 +0000 |
commit | a4dd5792616b6bdc905a1f9ebbd2271fb6e3c34c (patch) | |
tree | dfe02d37dc708c2e3fa1b18ae9d0cd72b9f99e3f /lib/api/helpers.rb | |
parent | 0a58a8c8258d26e7f5c782ca1cce8665d230fa83 (diff) | |
parent | 70b9d8da4c24bc2317220bedb81b5d2ecf34c351 (diff) | |
download | gitlab-ce-a4dd5792616b6bdc905a1f9ebbd2271fb6e3c34c.tar.gz |
Merge branch '27520-option-to-prevent-signing-in-from-multiple-ips' into 'master'
GitLab should have an option to prevent users from signing in from multiple IPs
Closes #27520
See merge request !8998
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index a43252a4661..f325f0a3050 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -336,16 +336,17 @@ module API def initial_current_user return @initial_current_user if defined?(@initial_current_user) + Gitlab::Auth::UniqueIpsLimiter.limit_user! do + @initial_current_user ||= find_user_by_private_token(scopes: @scopes) + @initial_current_user ||= doorkeeper_guard(scopes: @scopes) + @initial_current_user ||= find_user_from_warden - @initial_current_user ||= find_user_by_private_token(scopes: @scopes) - @initial_current_user ||= doorkeeper_guard(scopes: @scopes) - @initial_current_user ||= find_user_from_warden + unless @initial_current_user && Gitlab::UserAccess.new(@initial_current_user).allowed? + @initial_current_user = nil + end - unless @initial_current_user && Gitlab::UserAccess.new(@initial_current_user).allowed? - @initial_current_user = nil + @initial_current_user end - - @initial_current_user end def sudo! |