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
d0bfe999
Commit
d0bfe999
authored
Oct 04, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CE->EE] Better way to solve collision of log_failed_login method name
parent
d69d0c0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
11 deletions
+3
-11
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+1
-3
ee/app/controllers/ee/sessions_controller.rb
ee/app/controllers/ee/sessions_controller.rb
+2
-8
No files found.
app/controllers/sessions_controller.rb
View file @
d0bfe999
...
@@ -15,7 +15,7 @@ class SessionsController < Devise::SessionsController
...
@@ -15,7 +15,7 @@ class SessionsController < Devise::SessionsController
before_action
:auto_sign_in_with_provider
,
only:
[
:new
]
before_action
:auto_sign_in_with_provider
,
only:
[
:new
]
before_action
:load_recaptcha
before_action
:load_recaptcha
after_action
:log_failed_login
,
only:
[
:new
]
after_action
:log_failed_login
,
only:
[
:new
]
,
if: :failed_login?
def
new
def
new
set_minimum_password_length
set_minimum_password_length
...
@@ -48,8 +48,6 @@ class SessionsController < Devise::SessionsController
...
@@ -48,8 +48,6 @@ class SessionsController < Devise::SessionsController
private
private
def
log_failed_login
def
log_failed_login
return
unless
failed_login?
Gitlab
::
AppLogger
.
info
(
"Failed Login: username=
#{
user_params
[
:login
]
}
ip=
#{
request
.
remote_ip
}
"
)
Gitlab
::
AppLogger
.
info
(
"Failed Login: username=
#{
user_params
[
:login
]
}
ip=
#{
request
.
remote_ip
}
"
)
end
end
...
...
ee/app/controllers/ee/sessions_controller.rb
View file @
d0bfe999
...
@@ -2,19 +2,13 @@ module EE
...
@@ -2,19 +2,13 @@ module EE
module
SessionsController
module
SessionsController
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
prepended
do
after_action
:log_failed_login_ee
,
only: :new
,
if: :failed_login?
end
private
private
def
log_failed_login
_ee
def
log_failed_login
::
AuditEventService
.
new
(
request
.
filtered_parameters
[
'user'
][
'login'
],
nil
,
ip_address:
request
.
remote_ip
)
::
AuditEventService
.
new
(
request
.
filtered_parameters
[
'user'
][
'login'
],
nil
,
ip_address:
request
.
remote_ip
)
.
for_failed_login
.
unauth_security_event
.
for_failed_login
.
unauth_security_event
end
def
failed_login?
super
env
[
'warden.options'
]
&&
env
[
'warden.options'
][
:action
]
==
'unauthenticated'
end
end
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