diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-06-18 16:02:22 +0200 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-06-19 11:24:59 +0200 |
commit | a1eb1ad1685c88de953ad15c1f48f74b10e4ae3e (patch) | |
tree | 5fdcc5d7adf1f8709a5e1839deb2430304029e51 | |
parent | b64351478a6eec7b50ffa6017bc58fefda60c2a7 (diff) | |
download | gitlab-ce-a1eb1ad1685c88de953ad15c1f48f74b10e4ae3e.tar.gz |
Redirect back to current page after sign in.
-rw-r--r-- | app/controllers/application_controller.rb | 14 |
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 |