usually if you would set in your app config dir into security.yml
all:
  is_secure: on
then you won't have to worry .. any directory that would access your user,
will be automatically redirected to "login" form unless he's already logged
in.
That would mean the page that was requested becomes the referer. So, the
plugin will automatically redirect you to the initially requested page.

Have a look to backend of any application that uses unmodified
"sfguardPlugin" .

Alecs

On Fri, May 15, 2009 at 6:55 AM, nick <lal...@teamlalala.com> wrote:

>
>
> I noticed that this problem used to be common, a year ago, but it was
> supposedly fixed 6 months ago, in ticket #3212:
>
> http://trac.symfony-project.org/ticket/3212
>
> So I tried changing this:
>
> $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url',
> $user->getReferer('@homepage'));
>
> to this:
>
> $signinUrl = $user->getAttribute('referer') ? $user->getAttribute
> ('referer') : $this->getRequest()->getReferer();
>
> But now I get "Redirect Loop - Firefox has detected that the server is
> redirecting the request for this address in a way that will never
> complete."
>
> I'm using Symfony 1.2.7 and sfGuardPlugin, not sure of version, but
> the files themselves say:  12075 2008-10-08.
>
>
>
> On May 14, 11:23 pm, nick <lal...@teamlalala.com> wrote:
> > On May 14, 8:42 pm, Sid Bachtiar <sid.bacht...@gmail.com> wrote:
> >
> > > That should be the default behaviour of sfGuardPlugin
> >
> > Yes, but somehow that is not working for us. When I look in
> > BasesfGuardAuthActions.class.php, I see this code:
> >
> >       $this->form->bind($request->getParameter('signin'));
> >       if ($this->form->isValid())
> >       {
> >         $values = $this->form->getValues();
> >         $this->getUser()->signin($values['user'], array_key_exists
> > ('remember', $values) ? $values['remember'] : false);
> >
> >         // always redirect to a URL set in app.yml
> >         // or to the referer
> >         // or to the homepage
> >         $signinUrl = sfConfig::get
> > ('app_sf_guard_plugin_success_signin_url', $user->getReferer
> > ('@homepage'));
> >
> >         return $this->redirect($signinUrl);
> >       }
> >
> > I can see that the call to sfConfig::get()  looks either for a URL set
> > in the config, or it looks to a response to getReferer.
> >
> > But we don't want the referer, we want the page that the user was
> > trying to get to, which isn't treated as the referer on my machine. So
> > if I'm at the home page and I try go here:
> >
> > index.php/wiki/show/id/54
> >
> > The home page is treated as the referer. But after the user signs in,
> > I want them to end up here:
> >
> > index.php/wiki/show/id/54
> >
> > If I change this:
> >
> > return $this->redirect($signinUrl);
> >
> > to this:
> >
> > return $this->redirect($request->getUri());
> >
> > then I end up with an infinite loop of redirection. (Or rather, if I
> > put getUri() in the login form that submits.)
> >
> > Ideally I could use $this->forward(), but this forward usually takes a
> > module and action like this:
> >
> > $this->forward('question', 'index');
> >
> > I think it would be a lot of work for me to fetch the id and squeeze
> > it in there.
> >
> > I could also drop out of Symfony and do this:
> >
> > header('Location: ' . $request->getUri());
> >
> > but that seems like a hack.
> >
> > All I want to know is how other Symfony developers handle this. I'd
> > like to do this the standard Symfony way.
> >
> > > But if you want to customize the signinSuccess.php, don't do it on the
> > > plugin directory.
> >
> > > Do it be creating
> > > "myproject/myapp/modules/sfGuardAuth/templates/signinSuccess.php" (do
> > > this manually, don't use symfony command line, e.g.: don't use symfony
> > > init-module).
> >
> > > This should override the plugin's signinSuccess.php
> >
> > > On Fri, May 15, 2009 at 12:23 PM, nick <lal...@teamlalala.com> wrote:
> >
> > > > If someone tries to go to a secure page, and they are not logged in,
> > > > they get redirected to the login page, which has this template:
> >
> > > > plugins/sfGuardPlugin/modules/sfGuardAuth/templates/signinSucess.php
> >
> > > > I'd like to remember where the user was coming from, and then send
> > > > them there if they log in successfully. Do I directly edit
> > > > signinSuccess.php, or do I override it somewhere else?
> >
> > > --
> > > Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz
> >
>


-- 
I am on twitter: http://twitter.com/alecslupu
I am on linkedIn: http://www.linkedin.com/in/alecslupu
Tel: (+4)0748.543.798

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to