A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearSymfony Action Security - How to forward after successful authentication? - page 1
User InfoPosts
Symfony Action Security - How to forward after successful authentication?#1
With Symfony's Action Security if a user has not been identified he will be forwarded to the default login action as defined in the applications settings.yml file. How would I forward the user to the originally requested action after the user is successfully authenticated?

posted date: 2008-12-11 01:28:00


Re: Symfony Action Security - How to forward after successful authentication?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-11 01:28:01


Re: Symfony Action Security - How to forward after successful authentication?#3
On first hit to your login action, store referer to the user session:if(!$this->getUser()->hasParameter('referer')){ $this->getUser()->setParameter('referer',$this->getRequest()->getReferer());}and then when login succeeds, redirect user to stored referer with:$this->redirect($this->getUser()->getParameter('referer'));You have complete example in sfGuardPlugin:http://www.symfony-project.org/plugins/sfGuardPlugin

posted date: 2008-12-12 13:39:00


Re: Symfony Action Security - How to forward after successful authentication?#4
More simply...$this->getUser()->setReferer($this->getRequest()->getReferer());likesetReferer($referer){ if (!$this->hasAttribute('referer')) $this->setAttribute('referer', $referer);}

posted date: 2009-09-08 21:27:00


Re: Symfony Action Security - How to forward after successful authentication?#5
I had problems using the attribute with name 'referer'. Using a different name solved the problem.

posted date: 2011-07-28 08:38:00


Re: Symfony Action Security - How to forward after successful authentication?#6
A related problem, but instead trying to perform the forward from a different action:If you have an action protected by sfGuard which is attempting to redirect to the referrer, you will get a redirect loop after signing in. This is because the sign-in page of sfGuard wil become the referrer. A parameter or attribute can be saved over multiple requests if stored in the sign-in action as above, meaning the action might be redirecting to an incorrect page if already signed in. The solution is to use a flash which will be forgotten. This can be accomplished with the following code in the executeSignin method of sfGuardAuthActions:if ($this->getUser()->hasFlash('referer')){ $this->getUser()->setFlash('referer', $this->getUser()->getFlash('referer'));}else{ $this->getUser()->setFlash('referer', $this->getRequest()->getReferer());}By resetting the flash in the first block, it won't be forgotten between login attempts, and by using a flash, signing in from other pages can't interfere with your action.

posted date: 2011-07-28 09:53:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.