I got it sorted!! I overlooked the fact that I only need to know the previous URL in my login and logout actions. So I don't need to set the URL for each controller action, I just use $this- >redirect($_SERVER['HTTP_REFERER']) instead. Much easier!
Thanks for the replies! On Jun 19, 1:39 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > I think you will need to create your own handler for that. > > For example, you might do something like "document.location.href = > document.location.href;" to refresh the page after you receive > response from your AJAX login. > > On Jun 19, 2:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Hi Martin, > > Thanks for the reply. I am using the Auth component, but the problem > > is that my login action is in an Ajax updated lightbox. When the login > > tries to redirect from that lightbox, it only redirects within the > > lightbox, not the whole page. Do you know if this is possible? > > > Thanks! > > > On Jun 19, 12:38 pm, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Just to make sure: You have tried the AuthComponent in CakePHP? It > > > redirects you back to the last page visited automatically. It uses the > > > "referer" value and should not direct you back to an ajax-snippet but > > > to the last "proper" url (as seen in the browsers address bar). > > > > If it does not do what you want, maybe you could explain in more > > > detail what you need? > > > If you are doing all your authentication yourself or using some other > > > authentication library I would suggest looking at AuthComponent. You > > > can definitely lift a few ideas from that to tweak your current setup. > > > > Basically, if you are rolling your own, the concept is to use the http > > > referer information and to save it only when you end up at the login > > > page for the first time. > > > > /Martin > > > > On Jun 18, 11:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > wrote: > > > > > Hi all, > > > > When my users login, I want to redirect them to the page they were on > > > > before they chose Login. This I was doing in beforeFilter() of > > > > app_controller.php, by storing the current URL in the session. > > > > However, some of my pages have multiple actions on them, which messes > > > > this code up. For instance, I have a page with many content boxes, > > > > which are populated by Ajax. Even though the URL of the page is > > > > controller/action/, everytime one of the content boxes is loaded, the > > > > current URL in the session is overwritten. Then when the user logs in, > > > > they are brought to the individual page of the last content box, when > > > > I want them to go to the overall page. > > > > I have also tried adding code to a header element, but you cannot > > > > write to the session from a view. > > > > > Has anyone got any ideas?? > > > > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
