Don't set the loginRedirect in your beforeFilter, and then just use
$this->Auth->redirect() in your login function as follows:
/**
* Login function - this is where we do the login ...
*/
function login() {
if ($this->Auth->user())
{
$this->Session->SetFlash(__('Successfully logged in as '.
$auth_user['User']['full_name'],true));
$this->redirect($this->Auth->redirect());
}
}
On Jan 5, 3:22 am, "Novice Programmer" <[email protected]>
wrote:
> Hello All,
>
> I am trying to set up auth redirect. i.e the user will be redirected to
> login screen if he accesses a page which can't be accessed without the
> username/password. After the user authenticates, I try to redirect the user
> back to the page which he was accessing using
> $this->redirect($this->Auth->referer());
>
> Though the user is redirected to the proper page but my custom Routes break
> when such a redirection happens. Here is my auth setup.
>
> $this->Auth->actionPath = null;
> $this->Auth->loginAction = array('controller' => 'invites',
> 'action' => 'index');
> $this->Auth->loginRedirect = array('controller' => 'entities',
> 'action' => 'index');
> $this->Auth->logoutRedirect = null;
>
> Please help on how to go about fixing this.
> --
> Thanks & Regards,
> Novice.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---