A client uses the 'Login as user' behaviour to be able to see what users of the site are seeing, useful as it's an e-learning site and each user can see different content based on their progress. The users however, are only allowed to view the public site and not anything in the CP which means when the 'Login as user' is invoked the client is presented with the 'Unauthorized You don’t have the proper credentials to access this page' message.

Is this right? Looking through the code it seems the function _handleSuccessfulLogin() is called and if the user cannot access the CP then they should be redirected to the postLoginRedirect which in the case of this site is not set, so the user should be redirected to the homepage if I understand correctly.

  • Per Brad's answer, this was a bug and has been fixed. Since this question no longer has any historical value, it will be closed as a "bug report".
    – Lindsey D
    Nov 30, 2014 at 4:41

1 Answer 1


You're correct... it should be sending to postLoginRedirect, but there is actually a bug where after impersonating:

// Get the current user
$currentUser = craft()->userSession->getUser();

is returning a cached copy of the previous user (who had CP access).

Will get that fixed for the next release.


Fixed for the next post 2.2.2596 release!

Not the answer you're looking for? Browse other questions tagged or ask your own question.