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
746b7e2d
Commit
746b7e2d
authored
Jul 28, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'only_redirect_to_referer_from_public' into 'master'
Only redirect to referrer from public GitLab pages See merge request !995
parents
00c67238
3a6f9c09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
sessions_controller.rb
app/controllers/sessions_controller.rb
+6
-2
_public_head_panel.html.haml
app/views/layouts/_public_head_panel.html.haml
+2
-2
No files found.
app/controllers/sessions_controller.rb
View file @
746b7e2d
class
SessionsController
<
Devise
::
SessionsController
def
new
redirect_
url
=
if
request
.
referer
.
present?
redirect_
path
=
if
request
.
referer
.
present?
&&
(
params
[
'redirect_to_referer'
]
==
'yes'
)
referer_uri
=
URI
(
request
.
referer
)
if
referer_uri
.
host
==
Gitlab
.
config
.
gitlab
.
host
referer_uri
.
path
...
...
@@ -12,7 +12,11 @@ class SessionsController < Devise::SessionsController
request
.
fullpath
end
store_location_for
(
:redirect
,
redirect_url
)
# Prevent a 'you are already signed in' message directly after signing:
# we should never redirect to '/users/sign_in' after signing in successfully.
unless
redirect_path
==
'/users/sign_in'
store_location_for
(
:redirect
,
redirect_path
)
end
super
end
...
...
app/views/layouts/_public_head_panel.html.haml
View file @
746b7e2d
...
...
@@ -13,10 +13,10 @@
%i
.icon-reorder
.pull-right.hidden-xs
=
link_to
"Sign in"
,
new_session_path
(
:user
),
class:
'btn btn-sign-in btn-new'
=
link_to
"Sign in"
,
new_session_path
(
:user
,
redirect_to_referer:
'yes'
),
class:
'btn btn-sign-in btn-new'
.navbar-collapse.collapse
%ul
.nav.navbar-nav
%li
.visible-xs
=
link_to
"Sign in"
,
new_session_path
(
:user
)
=
link_to
"Sign in"
,
new_session_path
(
:user
,
redirect_to_referer:
'yes'
)
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