I’m using Restful Authentication and I’d like to be able to log in as different users on our site to investigate issues they may be having (“see what they see”). Since all passwords are encrypted I obviously can’t just use their passwords.
So, how can I force a session to be logged in as a specific user?
In your
sessions_controlleradd actionimpersonatelike this:Then in your routes extend session resource with the member
impersonate:Finally, somewhere in your admin views add a button to each user called “Impersonate”. It will have to look something like this (assuming that user is in local variable
user):Using this approach you also avoid overriding any tracking data such as time of the last login, etc.
P.S. Don’t forget to require admin for
impersonateaction in sessions controller.