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
b98a88cf
Commit
b98a88cf
authored
Apr 23, 2018
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport helpers from GroupSAML failure messages
parent
ad9e0091
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+2
-2
login_helpers.rb
spec/support/helpers/login_helpers.rb
+8
-0
routes_helpers.rb
spec/support/helpers/routes_helpers.rb
+7
-0
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
b98a88cf
...
...
@@ -26,11 +26,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# Extend the standard message generation to accept our custom exception
def
failure_message
exception
=
env
[
"omniauth.error"
]
exception
=
request
.
env
[
"omniauth.error"
]
error
=
exception
.
error_reason
if
exception
.
respond_to?
(
:error_reason
)
error
||=
exception
.
error
if
exception
.
respond_to?
(
:error
)
error
||=
exception
.
message
if
exception
.
respond_to?
(
:message
)
error
||=
env
[
"omniauth.error.type"
].
to_s
error
||=
request
.
env
[
"omniauth.error.type"
].
to_s
error
.
to_s
.
humanize
if
error
end
...
...
spec/support/helpers/login_helpers.rb
View file @
b98a88cf
...
...
@@ -132,6 +132,14 @@ module LoginHelpers
env
[
'omniauth.auth'
]
=
OmniAuth
.
config
.
mock_auth
[
provider
.
to_sym
]
end
def
stub_omniauth_failure
(
strategy
,
message_key
,
exception
=
nil
)
env
=
@request
.
env
env
[
'omniauth.error'
]
=
exception
env
[
'omniauth.error.type'
]
=
message_key
.
to_sym
env
[
'omniauth.error.strategy'
]
=
strategy
end
def
stub_omniauth_saml_config
(
messages
)
set_devise_mapping
(
context:
Rails
.
application
)
Rails
.
application
.
routes
.
disable_clear_and_finalize
=
true
...
...
spec/support/helpers/routes_helpers.rb
0 → 100644
View file @
b98a88cf
module
RoutesHelpers
def
fake_routes
(
&
block
)
@routes
=
@routes
.
dup
@routes
.
formatter
.
clear
ActionDispatch
::
Routing
::
Mapper
.
new
(
@routes
).
instance_exec
(
&
block
)
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