Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-08-03 14:06:38 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-08-03 14:06:38 +0300
commit0dd0dc2367453f4c63965053a88851332d7c462d (patch)
treea63645d9b77046c72ef83bf038ecc1faa0fb3e03 /config
parentef28641d03acf08f286632569983f5ec2eda5871 (diff)
Simplify the check of reduntant user logout events
Diffstat (limited to 'config')
-rw-r--r--config/initializers/warden.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/config/initializers/warden.rb b/config/initializers/warden.rb
index 841f4aa1da9..33f55069c3e 100644
--- a/config/initializers/warden.rb
+++ b/config/initializers/warden.rb
@@ -30,11 +30,11 @@ Rails.application.configure do |config|
end
Warden::Manager.before_logout(scope: :user) do |user, auth, opts|
+ user ||= auth.user
activity = Gitlab::Auth::Activity.new(opts)
tracker = Gitlab::Auth::BlockedUserTracker.new(user, auth)
- ActiveSession.destroy(user || auth.user, auth.request.session.id)
-
+ ActiveSession.destroy(user, auth.request.session.id)
activity.user_session_destroyed!
##
@@ -42,16 +42,16 @@ Rails.application.configure do |config|
# multiple times during the request lifecycle. We want to increment
# metrics and write logs only once in that case.
#
- # 'warden.auth.trackers' is our custom hash key that follows usual
- # convention of naming keys in the Rack env hash. If there is more
- # than one tracker in the hash it means that we have already recorded
- # an event.
+ # 'warden.auth.*' is our custom hash key that follows usual convention
+ # of naming keys in the Rack env hash.
#
- next if (auth.env['warden.auth.trackers'] ||= []).push(activity).many?
+ next if auth.env['warden.auth.user.blocked']
if user.blocked?
activity.user_blocked!
tracker.log_activity!
end
+
+ auth.env['warden.auth.user.blocked'] = true
end
end