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
3bef58b4
Commit
3bef58b4
authored
Jun 10, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Geo flash information on first login
parent
7e7f552c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
app/controllers/oauth/geo_auth_controller.rb
app/controllers/oauth/geo_auth_controller.rb
+10
-3
No files found.
app/controllers/oauth/geo_auth_controller.rb
View file @
3bef58b4
class
Oauth::GeoAuthController
<
ActionController
::
Base
include
ActionView
::
Helpers
::
UrlHelper
rescue_from
Gitlab
::
Geo
::
OauthApplicationUndefinedError
,
with: :undefined_oauth_application
rescue_from
OAuth2
::
Error
,
with: :auth
...
...
@@ -25,9 +26,7 @@ class Oauth::GeoAuthController < ActionController::Base
user
=
User
.
find_by
(
id:
remote_user
[
'id'
])
if
user
&&
sign_in
(
user
,
bypass:
true
)
session
[
:access_token
]
=
token
return_to
=
oauth
.
get_oauth_state_return_to
redirect_to
(
return_to
||
root_path
)
after_sign_in_with_gitlab
(
token
,
oauth
.
get_oauth_state_return_to
)
else
invalid_credentials
end
...
...
@@ -46,6 +45,14 @@ class Oauth::GeoAuthController < ActionController::Base
private
def
after_sign_in_with_gitlab
(
token
,
return_to
)
primary_node
=
link_to
(
'primary node'
,
Gitlab
::
Geo
.
primary_node
.
url
)
flash
[
:notice
]
=
"You are in a Geo secondary node (read-only). To make any change you must visit the
#{
primary_node
}
."
.
html_safe
session
[
:access_token
]
=
token
redirect_to
(
return_to
||
root_path
)
end
def
invalid_credentials
@error
=
'Cannot find user to login. Your account may have been deleted.'
render
:error
,
layout:
'errors'
...
...
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