On successful login, Auth Component does a redirect to either:
1. where you were before you were redirected to the login screen (not
in your case I guess)
2. whatever default you have set
3. the website index page.
(I think that is the correct order)

I guess your problem is that your ajax call does not follow the
redirect and loads the resulting page. I don't use ajax enough to be
sure of that or what can be done about it.

What you can do is to turn off the auto redirect for Auth and yourself
check if the login was a success and if that success was due to an
ajax call. Use the RequestHandler to check for ajax.

/Martin


On Sep 9, 5:45 am, "young.steveo" <young.ste...@gmail.com> wrote:
> I've posted this elsewhere on the internets, and finally I'm bringing
> it to you guys.
>
> Just started using cake and it's fantastic!  Love it.
>
> Here's my little problem:
>
> I have a form that I am suppressing with jQuery and doing an AJAX call
> to a controller 'UsersController' with a 'login' action that is
> working automagically using the built in Auth component.
>
> I'm following ProLoser's example from the bakery:
>
> http://bakery.cakephp.org/articles/view/serving-up-actions-as-ajax-wi...
>
> The only exception is that I'm using the livequery jQuery plugin to
> support the "submit" event.
>
> My homepage has a copy of the form inside a div, and the the 'users/
> login.ctp' view has a copy of the form as well. When the user submits
> the form, jQuery removes the form from the div.  The form is submitted
> via ajax to the UsersController, and if the user has failed to
> authenticate, he is served the 'users/login.ctp' view inside the same
> div using ajax. This all works.
>
> If the user DOES authenticate, he is also served the login.ctp inside
> the div. Instead, I want to change the view to something that says
> "welcome, etc. etc. etc." with no login form.
>
> I've bashed my brains into the cookbook, the API, and google to no
> avail. I feel like this is something super easy to do, but I'm barking
> up the wrong trees.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to