Tuesday, March 31, 2009

Re: How to silently redirects to login page ?

Since you only mentioned a problem on the "index page" I did not go
into anything more complicated.

You can either remove it from the session before displaying the login
screen. Then it will pop up anywhere else.

Alternatively you can make an if-clause:
if ( $this->Auth->user() ) {
// user is logged in show error message if needed
$this->Auth->authError = 'Hey, be nice, only admins can do that';
} else {
// no user logged in, show nice message
$this->Auth->authError = 'Hi, and welcome. Please login before
proceeding.';
}

... or something similar.


On Mar 30, 9:28 pm, iFeghali <igor.fegh...@gmail.com> wrote:
> Hi Martin,
>
> Yes I am talking exactly about that message. Changing it the way you
> suggest would make it very weird to users already logged in that are
> trying to access resources they are not allowed to. Also, I would like
> to have no message at all... just the login form.
>
> Thank you.
>
> On 30 mar, 15:28, Martin Westin <martin.westin...@gmail.com> wrote:
>
> > That would be the authError message you are seeing.
>
> > You can set it (from AppController::beforeFilter for example) like
> > this:
>
> > $this->Auth->authError = 'Hi, and welcome. Please login before
> > proceeding.';
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: