I fixed this one myself. I'm still not sure if this is the best way
to do things, but here's how I got it to work:
In my controller, in beforeFilter(), I set a session variable called
auth.page. It's value is set with this code:
$temp = str_replace("url=","/",$_SERVER['QUERY_STRING']);
$this->Session->write('auth.page', $temp);
In my auth plugin, I check to see if auth.page == '', and if it does,
I set it to '/'. Now I do my redirects to auth.page.
When you call $_SERVER['QUERY_STRING'] on a page where you don't give
the controller/action (in routes I have / set to tickets/add/),
Query_String comes back blank, so I set it to '/', which make the
redirect work without errors.
BTW, I did the str_replace above because $_SERVER['QUERY_STRING']
prefaces everything with url= .
On Mar 6, 11:01 am, "hydra12" <[EMAIL PROTECTED]> wrote:
> I'm working on a plugin for acl and authentication. When someone goes
> to a page, if they haven't logged in yet, they are redirected to my
> authentication plugin. When they successfully authenticate, they are
> redirected back to the original page they tried to view. To do this,
> when they are redirected to the auth page, I also pass the controller
> and action. Redirecting back to the original page works fine EXCEPT
> when the original page is an admin page. The controller gets passed
> as admin_index. On redirect, they end up at /tickets/admin_index/
> instead of /admin/tickets/index, which doesn't work.
>
> I understand why this is happening. Anybody have a suggestion on how
> I can fix it, or maybe a better way to redirect back to the calling
> page?
>
> Thanks!
> hydra12
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---