5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/concerns/effective/impersonation_controller/destroy.rb', line 5
def destroy
if current_user.blank?
session[:impersonation_user_id] = nil
session[:impersonation_original_path] = nil
redirect_to(root_path) and return
end
@user = current_user.class.find(session[:impersonation_user_id])
redirect_path = after_destroy_impersonate_path_for(@user)
session[:impersonation_user_id] = nil
session[:impersonation_original_path] = nil
expire_data_after_sign_in!
warden.session_serializer.store(@user, Devise::Mapping.find_scope!(@user))
redirect_to(redirect_path)
end
|