On Oct 26, 6:41 pm, "Ian P. Christian" <[EMAIL PROTECTED]> wrote:
> This little snippet of code will redirect an unauthentacted user to the
> login form to a URL like:
>
> http://site/admin_login?url=http%3A%2F%2F...&timedout=0
>
> This allows the login form to redirect a user back to the page they were
> trying to access in the first place before requiring auth, and allows
> for a message to be displayed if the user has been timed out.
>
Do you really need to track the URL explicitly? In my case user's
presented with the login form whenever needed, stating the reason
(expired or insufficient privileges) on the same page he tries to
visit, and then, assuming login validator returns success:
public function executeLogin()
{
if ($this->getRequest()->getMethod() ==
sfRequest::POST) {
$this->redirect($this->getRequest()-
>getUri());
}
}
That's pretty much it. No need for "anti-smart" URL complications. Of
course this is not ideal if some previous POST got intercepted by auth
revalidation, but if you keep maintaining your URL's unrelated to
request method (i.e. GET and POST have the same URL -- as I do), then
upon re-authentication the user would simply be taken back to editing
the same form from where he originally POSTed, this time via GET.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---