BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
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
if
@user
.
two_factor_enabled?
prompt_for_two_factor
(
@user
)
else
log_audit_event
(
@user
,
with:
:ldap
)
log_audit_event
(
@user
,
with:
oauth
[
'provider'
]
)
sign_in_and_redirect
(
@user
)
end
else
flash
[
:alert
]
=
"Access denied for your LDAP account."
redirect_to
new_user_session_path
fail_ldap_login
end
end
...
...
@@ -123,9 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
sign_in_and_redirect
(
@user
)
end
else
error_message
=
@user
.
errors
.
full_messages
.
to_sentence
return
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
fail_login
end
end
...
...
@@ -145,6 +142,18 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def
oauth
@oauth
||=
request
.
env
[
'omniauth.auth'
]
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
=
{})
AuditEventService
.
new
(
user
,
user
,
options
)
...
...
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