When a user clicks on a link that requires a login, we are currently redirecting them to the login page, but we are losing the destination URL. What is the best way to consider this URL and redirect the user to the requested page after logging in?
We use the latest stable version of Cake. Thank.
- Edit -
It is configured in this way.
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
user_controller login function
function login() {
Debugger::log("Redirect Session Key:" . $this->Session->read('Auth.redirect'), $level = 7);
$ref = $this->referer();
Debugger::log("referer():" . $ref, $level = 7);
}
, localhost/mysite/unauthorized, localhost/mysite/users/login. debug.log Redirect / , , . , , "/", .