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
ca8b3a2f
Commit
ca8b3a2f
authored
Mar 09, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display error when we cannot find an OAuth Application for the Geo node
parent
9b817e66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
app/controllers/oauth/geo_auth_controller.rb
app/controllers/oauth/geo_auth_controller.rb
+5
-0
lib/gitlab/geo.rb
lib/gitlab/geo.rb
+4
-1
No files found.
app/controllers/oauth/geo_auth_controller.rb
View file @
ca8b3a2f
class
Oauth::GeoAuthController
<
ActionController
::
Base
rescue_from
Gitlab
::
Geo
::
RemoteNode
::
InvalidCredentialsError
,
with: :invalid_credentials
rescue_from
Gitlab
::
Geo
::
OauthApplicationUndefinedError
,
with: :undefined_oauth_application
rescue_from
OAuth2
::
Error
,
with: :auth
def
auth
...
...
@@ -39,4 +40,8 @@ class Oauth::GeoAuthController < ActionController::Base
render
:error
,
layout:
'errors'
end
def
undefined_oauth_application
@error
=
'There is no OAuth application defined for this Geo node.'
render
:error
,
layout:
'errors'
end
end
lib/gitlab/geo.rb
View file @
ca8b3a2f
module
Gitlab
module
Geo
class
OauthApplicationUndefinedError
<
StandardError
;
end
def
self
.
current_node
RequestStore
.
store
[
:geo_node_current
]
||=
begin
GeoNode
.
find_by
(
host:
Gitlab
.
config
.
gitlab
.
host
,
...
...
@@ -43,7 +45,8 @@ module Gitlab
def
self
.
oauth_authentication
return
false
unless
Gitlab
::
Geo
.
secondary?
RequestStore
.
store
[
:geo_oauth_application
]
||=
Gitlab
::
Geo
.
current_node
.
oauth_application
RequestStore
.
store
[
:geo_oauth_application
]
||=
Gitlab
::
Geo
.
current_node
.
oauth_application
or
raise
GeoOauthApplicationUndefinedError
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