summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-07-22 08:34:16 +0200
committerMarin Jankovski <marin@gitlab.com>2014-07-22 08:34:16 +0200
commitb4217500352efcc463ee0517a97d37c41e66ddd5 (patch)
treed75186685ee913713369da6c6fc82b134a008830
parent9714061bb0f099f3800ffdc75bc8807ee783e32a (diff)
downloadgitlab-ce-b4217500352efcc463ee0517a97d37c41e66ddd5.tar.gz
Call store_location_for once.
-rw-r--r--app/controllers/sessions_controller.rb22
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