How could I check if a user has left my login form? Not logging in but actually leaving it?
As I want to delete the Auth.redirect session if they choose not to login so that when they return later they are not taken to their previous session!
So essentially running this:
$this->Session->delete('Auth.redirect');
I’m thinking some kind of check in the AppController that knows when a user was referred from the login form and deletes the session auth.redirect???
Or better yet checking if the current page is the login form and if not then delete the session!!!
and for those that are interested, this is how my login method currently looks:
function login()
{
if(!(empty($this->data)) && $this->Auth->user())
{
$back_to = $this->Session->read('back_to');
$auth_redirect = $this->Session->read('Auth.redirect');
if($auth_redirect)
{
$this->redirect($auth_redirect, null, true);
}
else if($back_to)
{
$this->redirect($back_to, null, true);
}
else
{
$this->redirect($this->Auth->redirect(), null, true);
}
}
else
{
$this->Session->write('back_to', $this->referer());
}
}
Thanks
or this: