summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-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