diff options
| author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-08-01 14:23:06 +0200 |
|---|---|---|
| committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-08-01 14:23:06 +0200 |
| commit | 4bcf72e734fbafe99ec603d34819b8ab68bf390c (patch) | |
| tree | 1c293c3ea6a51fb752335b8f5624593511444e1b /app/controllers/application_controller.rb | |
| parent | e9d04585f872121d4b1f96e019946cfa48d2f915 (diff) | |
| download | gitlab-ce-4bcf72e734fbafe99ec603d34819b8ab68bf390c.tar.gz | |
Improve blocked user tracking and fire some events only once
Diffstat (limited to 'app/controllers/application_controller.rb')
| -rw-r--r-- | app/controllers/application_controller.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 73d7b8cb9cf..ce7bfb70c71 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -108,6 +108,7 @@ class ApplicationController < ActionController::Base def append_info_to_payload(payload) super + payload[:remote_ip] = request.remote_ip logged_user = auth_user @@ -122,12 +123,19 @@ class ApplicationController < ActionController::Base end end + ## # Controllers such as GitHttpController may use alternative methods - # (e.g. tokens) to authenticate the user, whereas Devise sets current_user + # (e.g. tokens) to authenticate the user, whereas Devise sets current_user. + # + # `current_user` call is going to trigger Warden::Proxy authentication + # that is going to invoke warden callbacks, so we use Warden directly here. + # def auth_user - return current_user if current_user.present? - - return try(:authenticated_user) + if warden.authenticated?(:user) + current_user + else + try(:authenticated_user) + end end # This filter handles personal access tokens, and atom requests with rss tokens |
