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
3a6f9c09
Commit
3a6f9c09
authored
Jul 25, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only redirect to referrer from public GitLab pages
parent
5a89b610
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+6
-2
app/views/layouts/_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 @
3a6f9c09
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 @
3a6f9c09
...
...
@@ -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