Using ActiveAdmin to login as any user

This commit is contained in:
Vokhmin Alexey V 2014-05-13 00:18:41 +04:00
parent b90aa0f50e
commit e9e451dba7
1 changed files with 9 additions and 0 deletions

View File

@ -47,10 +47,19 @@ ActiveAdmin.register User do
data: { confirm: 'Are you sure you want to reset token?' }
end
action_item only: :show do
link_to 'Login as user', login_as_admin_user_path(resource)
end
member_action :reset_token, :method => :put do
resource.reset_authentication_token!
flash[:info] = 'User token reseted successfully'
redirect_to admin_user_path(resource)
end
member_action :login_as do
sign_in(resource, bypass: true)
redirect_to root_path
end
end