summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-06-18 16:02:22 +0200
committerMarin Jankovski <marin@gitlab.com>2014-06-19 11:24:59 +0200
commita1eb1ad1685c88de953ad15c1f48f74b10e4ae3e (patch)
tree5fdcc5d7adf1f8709a5e1839deb2430304029e51 /app/controllers/application_controller.rb
parentb64351478a6eec7b50ffa6017bc58fefda60c2a7 (diff)
downloadgitlab-ce-a1eb1ad1685c88de953ad15c1f48f74b10e4ae3e.tar.gz
Redirect back to current page after sign in.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 603e89a5e29..ad65bd13935 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,6 +1,7 @@
require 'gon'
class ApplicationController < ActionController::Base
+ before_filter :store_location
before_filter :authenticate_user!
before_filter :reject_blocked!
before_filter :check_password_expiration
@@ -48,7 +49,18 @@ class ApplicationController < ActionController::Base
flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
new_user_session_path
else
- super
+ session[:previous_url] || root_path
+ end
+ end
+
+ def store_location
+ # store last url - this is needed for post-login redirect to whatever the user last visited.
+ if (request.fullpath != "/users/sign_in" &&
+ request.fullpath != "/users/sign_up" &&
+ request.fullpath != "/users/password" &&
+ request.fullpath != "/users/sign_out" &&
+ !request.xhr?) # don't store ajax calls
+ session[:previous_url] = request.fullpath
end
end