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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d0bab339
Commit
d0bab339
authored
May 07, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only run session related Warden hooks for user scope
parent
5116b59f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
config/initializers/warden.rb
config/initializers/warden.rb
+5
-5
No files found.
config/initializers/warden.rb
View file @
d0bab339
Rails
.
application
.
configure
do
|
config
|
Rails
.
application
.
configure
do
|
config
|
Warden
::
Manager
.
after_set_user
do
|
user
,
auth
,
opts
|
Warden
::
Manager
.
after_set_user
(
scope: :user
)
do
|
user
,
auth
,
opts
|
Gitlab
::
Auth
::
UniqueIpsLimiter
.
limit_user!
(
user
)
Gitlab
::
Auth
::
UniqueIpsLimiter
.
limit_user!
(
user
)
end
end
Warden
::
Manager
.
before_failure
do
|
env
,
opts
|
Warden
::
Manager
.
before_failure
(
scope: :user
)
do
|
env
,
opts
|
Gitlab
::
Auth
::
BlockedUserTracker
.
log_if_user_blocked
(
env
)
Gitlab
::
Auth
::
BlockedUserTracker
.
log_if_user_blocked
(
env
)
end
end
Warden
::
Manager
.
after_authentication
do
|
user
,
auth
,
opts
|
Warden
::
Manager
.
after_authentication
(
scope: :user
)
do
|
user
,
auth
,
opts
|
ActiveSession
.
cleanup
(
user
)
ActiveSession
.
cleanup
(
user
)
end
end
Warden
::
Manager
.
after_set_user
only: :fetch
do
|
user
,
auth
,
opts
|
Warden
::
Manager
.
after_set_user
(
scope: :user
,
only: :fetch
)
do
|
user
,
auth
,
opts
|
ActiveSession
.
set
(
user
,
auth
.
request
)
ActiveSession
.
set
(
user
,
auth
.
request
)
end
end
Warden
::
Manager
.
before_logout
do
|
user
,
auth
,
opts
|
Warden
::
Manager
.
before_logout
(
scope: :user
)
do
|
user
,
auth
,
opts
|
ActiveSession
.
destroy
(
user
||
auth
.
user
,
auth
.
request
.
session
.
id
)
ActiveSession
.
destroy
(
user
||
auth
.
user
,
auth
.
request
.
session
.
id
)
end
end
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