I implemented security according to this tutorial:
http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application
What I want it to do is if a user issues a request and isn't logged in, they are presented with the login page and then redirected back to their original request.
I think I need to add code in app_controller.php (the top level controller) to save the initial request as maybe a session variable, and then add a line at the end of this function in the users controller to redirect to the saved value:
function login() {
if ($this->Session->read('Auth.User')) {
$this->Session->setFlash('You are logged in!');
// redirect to referrer here
}
}
Am I on the right track here?