Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

When impersonating a user, store the current page and redirect back t…

…here when impersonation ends.
  • Loading branch information...
commit b55441d653c2649f82b3efbe434f32623551c979 1 parent f9d0819
@markkendall markkendall authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 app/controllers/blue_light_special/impersonations_controller.rb
View
7 app/controllers/blue_light_special/impersonations_controller.rb
@@ -14,8 +14,9 @@ def create
flash[:failure] = "Cannot impersonate yourself"
redirect_to root_url
else
- session[:admin_user_id] = current_user.id
- session[:impersonation_hash] = Impersonation.hash_for(current_user.id)
+ session[:admin_user_id] = current_user.id
+ session[:impersonation_hash] = Impersonation.hash_for(current_user.id)
+ session[:impersonation_back_url] = request.env["HTTP_REFERER"]
sign_in(user)
redirect_to root_url
end
@@ -28,7 +29,7 @@ def destroy
session[:admin_user_id] = nil
session[:impersonation_hash] = nil
sign_in(admin_user)
- redirect_to impersonations_url
+ redirect_to session[:impersonation_back_url]
else
deny_access
end
Please sign in to comment.
Something went wrong with that request. Please try again.