I don't know, but I works for me.. :)

1. AFAIK logoutRedirect has not always to point to the loginAction..
2. I should set autoRedirect to FALSE, to make my app works. Whenever I set
it to true user can't login. I haven't diagnose this yet.. Just a quick fix.

3. "And it really doesn't make much sense to have your loginRedirect
pointed to itself."

Hmm... not really I think..

If you read comments here :
http://book.cakephp.org/view/248/AuthComponent-Variables
You'll find someone get the same problem with me.. I think the documentation
is wrong.

Because, $this->Auth->loginRedirect is used when you're accessing a page
that need authentication (login) meanwhile you haven't logged in yet..

So that's why I set $this->Auth->loginRedirect = array('controller' =>
'users', 'action' => 'login');
So, whenever unauthenticaed user visiting page that need authentication, he
will be redirected to /users/login.

That's based on my experiences.. CMIIW..

Okto.Silaban.Net

On Wed, Oct 1, 2008 at 12:50 AM, LunarDraco <[EMAIL PROTECTED]> wrote:

>
> In my original response, I mentioned there are a couple of
> requirements for this auth redirect issue to present itself and fail.
> 1 - logoutRedirect has to point to the loginAction. (your example
> doesn't)
> 2 - autoRedirect needs to be true. (your example is set to false)
> 3 - You've called the logout action from a link on different
> controller/action page than the user/logout page.
>
> And it really doesn't make much sense to have your loginRedirect
> pointed to itself.
>
> Your example will not show the problem. And it will not autoRedirect
> to a controlled page after authentication either.
>
> On Sep 30, 1:06 am, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> > How come? I get no problem with the syntax.. It works fine for me..
> >
> > This is the full code in app/app_controller.php (I just copy paste it)
> >
> > beforeFilter()
> > {
> >         $this->Auth->loginAction = array('controller' => 'users',
> 'action'
> > => 'login');
> >         $this->Auth->logoutRedirect = '/';
> >         $this->Auth->loginRedirect = array('controller' => 'users',
> 'action'
> > => 'login');
> >         $this->Auth->autoRedirect = FALSE;
> >
> > }
> >
> > Okto.Silaban.Net
> >
> > On Fri, Sep 26, 2008 at 10:00 PM, Tony Thomas <[EMAIL PROTECTED]>
> wrote:
> >
> > > This gives me an "unexpected T_VARIABLE" error on the line with $this-
> > > >Auth->autoRedirect = FALSE;
> >
> > > I think the algorithm might be right, but the syntax is wrong.
> >
> > > On Sep 17, 12:20 pm, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> > > > I'm not really sure, but I think :
> > > > $this->Auth->loginRedirect
> >
> > > > doesn't tell we're we gonna go after logging in..
> >
> > > > But, if we're acessing an area which not allowed by Auth, we will
> sent to
> > > > that page.. (if you're not login yet..).
> >
> > > > So I set that in beforeFilter :
> >
> > > > function beforeFilter() {
> > > >   $this->Auth->loginRedirect = array('controller' =>
> 'controller_name',
> > > > 'action' => 'index');
> > > >    $this->Auth->autoRedirect = FALSE; // so after logging in we're
> not
> > > auto
> > > > redirected
> >
> > > > }
> >
> > > > then manually set
> >
> > > > function login() {
> > > >     $this->redirect('somewhere');
> > > >     exit();
> >
> > > > }
> > > > On Tue, Sep 9, 2008 at 10:12 PM, Tony Thomas <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > If someone is familiar with a post to this group or blog entry that
> > > > > addresses this issue, please let me know. I've spent the morning
> > > > > scouring both with no satisfactory results.
> >
> > > > > I have a cakePHP app on a shared server. In local testing,
> everything
> > > > > worked fine. But mod_rewrite did not function properly on the
> shared
> > > > > server, so I'm using CakePHP pretty URLS instead. Also caching (at
> > > > > least temporarily) is off. I've uncommented the pertinent lines of
> > > > > code in core.php and I've dutifully deleted the .htaccess files.
> >
> > > > > The problem I have is that after logging in, the redirect is
> > > > > inconsistent. About 2/3 of the time I get redirected to
> > > > >https://[base_url]/https:/[domain]. I just can't seem to find away
> > > > > around this problem.
> >
> > > > > My login function looks like this:
> >
> > > > > function login() {
> > > > >                        $this->Auth->loginRedirect =
> array('controller'
> > > =>
> > > > > 'controller_name', 'action' => 'index');
> > > > >    }
> >
> > > > > I still get inconsistent results with the redirect going to a URL
> like
> > > > > the former example the majority of the time. Any insight, links,
> etc.
> > > > > would be appreciated.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to