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 class SessionsController < Devise::SessionsController
def new def new
if request.referer.present? redirect_url = if request.referer.present?
referer_uri = URI(request.referer) referer_uri = URI(request.referer)
if referer_uri.host == Gitlab.config.gitlab.host if referer_uri.host == Gitlab.config.gitlab.host
store_location_for(:redirect, referer_uri.path) referer_uri.path
else else
store_location_for(:redirect, request.fullpath) request.fullpath
end end
else else
store_location_for(:redirect, request.fullpath) request.fullpath
end end
store_location_for(:redirect, redirect_url)
super super
end end