Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
0dd0dc23
Commit
0dd0dc23
authored
Aug 03, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the check of reduntant user logout events
parent
ef28641d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
config/initializers/warden.rb
config/initializers/warden.rb
+7
-7
No files found.
config/initializers/warden.rb
View file @
0dd0dc23
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment