If the referer is not set, use fullpath.

This commit is contained in:
Marin Jankovski 2014-07-21 15:45:27 +02:00
parent cfde0936ea
commit 9714061bb0
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,14 @@ class SessionsController < Devise::SessionsController
def new
if request.referer.present?
store_location_for(:redirect, URI(request.referer).path)
referer_uri = URI(request.referer)
if referer_uri.host == Gitlab.config.gitlab.host
store_location_for(:redirect, referer_uri.path)
else
store_location_for(:redirect, request.fullpath)
end
else
store_location_for(:redirect, request.fullpath)
end
super

View File

@ -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