Call store_location_for once.

This commit is contained in:
Marin Jankovski 2014-07-22 08:34:16 +02:00
parent 9714061bb0
commit b421750035
1 changed files with 12 additions and 10 deletions

View File

@ -1,16 +1,18 @@
class SessionsController < Devise::SessionsController
def new
if request.referer.present?
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
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