diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-22 06:50:35 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-22 06:50:35 +0000 |
commit | 98c66b508caa810eb0d6b0f060aaee9e43411df5 (patch) | |
tree | 036703dae2e6c21d02a588a8d2884ea77d0bd9bf | |
parent | 4f47eaf9ae4c54d3c5aefa3cdf537d5bf739b533 (diff) | |
parent | b4217500352efcc463ee0517a97d37c41e66ddd5 (diff) | |
download | gitlab-ce-98c66b508caa810eb0d6b0f060aaee9e43411df5.tar.gz |
Merge branch 'use_fullpath' into 'master'
If referer in request is incorrect use fullpath
Fixes #1444
See merge request !982
-rw-r--r-- | app/controllers/sessions_controller.rb | 15 | ||||
-rw-r--r-- | features/steps/project/redirects.rb | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 9b7bd94c3a2..f7d5ca08c05 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,9 +1,18 @@ class SessionsController < Devise::SessionsController def new - if request.referer.present? - store_location_for(:redirect, URI(request.referer).path) - end + redirect_url = if request.referer.present? + referer_uri = URI(request.referer) + if referer_uri.host == Gitlab.config.gitlab.host + referer_uri.path + else + request.fullpath + end + else + request.fullpath + end + + store_location_for(:redirect, redirect_url) super end diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index 25d37fd7888..7e01735af95 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -17,6 +17,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps end step 'I should see project "Community" home page' do + Gitlab.config.gitlab.stub(:host).and_return("www.example.com") within '.project-home-title' do page.should have_content 'Community' end |