php - Symfony 1.4 - Pass URL in get request -


i want redirect previous page after login. first question best solution it?

i try following solution. send previous page url in request , redirect url in request.

this previous page action.

public function executevotes(sfwebrequest $request) {         $chaletid = (int) $request->getparameter('id');         $this->rates = (int) $request->getparameter('rates', 0);          if (             ($this->getuser()->isauthenticated() === false )             || ($this->getuser()->hascredential('member_permission') === false)         ) {             $this->redirect('member_signin', array(                 'redirect' => $this->getcontroller()->genurl('chalet_votes/' . $chaletid . '/?rates=' . $this->rates, true)             ));         } } 

this signin action

public function executesignin(sfwebrequest $request) {         $this->redirecturl = $this->getrequest()->getparameter('redirect');          echo $this->redirecturl; die; } 

this routers these actions.

member_signin:   url: /member/login/*   param: { module: member, action: signin}  votes:   url: /chalet/votes/:id   param: { module: test, action: votes } 

this url after redirect signin page.

http://test.dev/member/login/redirect/http%3a%2f%2fchalet.dev%2fchalet_votes%2f1%2frates%2f9 

my server show 404 page error. issue? how can it?

instead of redirecting non-authenticated user member_signin. try forwarding them:

$this->forward('member_signin'); 

because you're not redirecting, when post sign-in form, have referrer url available in $request->getreferer() method.

so you'll need in signin action:

public function executesignin(sfwebrequest $request) {     $user = $this->getuser();      // if user has been authenticated, helps prevent redirect loop well.     if ($user->isauthenticated()) {         $this->redirect('@defaultpage');     }      // authentication     //...      // if authenticated     $this->redirect($request->getreferer()); } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -