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
Jérome Perrin
gitlab-ce
Commits
aa25db89
Commit
aa25db89
authored
Aug 07, 2017
by
James Lopez
Committed by
Sean McGivern
Aug 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EE Backport] Update log audit event in omniauth_callbacks_controller.rb
parent
f9c6ff75
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+15
-6
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
aa25db89
...
@@ -34,12 +34,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -34,12 +34,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
if
@user
.
two_factor_enabled?
if
@user
.
two_factor_enabled?
prompt_for_two_factor
(
@user
)
prompt_for_two_factor
(
@user
)
else
else
log_audit_event
(
@user
,
with:
:ldap
)
log_audit_event
(
@user
,
with:
oauth
[
'provider'
]
)
sign_in_and_redirect
(
@user
)
sign_in_and_redirect
(
@user
)
end
end
else
else
flash
[
:alert
]
=
"Access denied for your LDAP account."
fail_ldap_login
redirect_to
new_user_session_path
end
end
end
end
...
@@ -123,9 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -123,9 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
sign_in_and_redirect
(
@user
)
sign_in_and_redirect
(
@user
)
end
end
else
else
error_message
=
@user
.
errors
.
full_messages
.
to_sentence
fail_login
return
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
end
end
end
end
...
@@ -146,6 +143,18 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -146,6 +143,18 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
@oauth
||=
request
.
env
[
'omniauth.auth'
]
@oauth
||=
request
.
env
[
'omniauth.auth'
]
end
end
def
fail_login
error_message
=
@user
.
errors
.
full_messages
.
to_sentence
return
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
end
def
fail_ldap_login
flash
[
:alert
]
=
'Access denied for your LDAP account.'
redirect_to
new_user_session_path
end
def
log_audit_event
(
user
,
options
=
{})
def
log_audit_event
(
user
,
options
=
{})
AuditEventService
.
new
(
user
,
user
,
options
)
AuditEventService
.
new
(
user
,
user
,
options
)
.
for_authentication
.
security_event
.
for_authentication
.
security_event
...
...
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