diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-07-22 08:34:16 +0200 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-07-22 08:34:16 +0200 |
commit | b4217500352efcc463ee0517a97d37c41e66ddd5 (patch) | |
tree | d75186685ee913713369da6c6fc82b134a008830 | |
parent | 9714061bb0f099f3800ffdc75bc8807ee783e32a (diff) | |
download | gitlab-ce-b4217500352efcc463ee0517a97d37c41e66ddd5.tar.gz |
Call store_location_for once.
-rw-r--r-- | app/controllers/sessions_controller.rb | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 3f896f46c6c..f7d5ca08c05 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -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 |