php - symfony 2 redirect if user is logged in and wants to call /login -
i've following problem in symfony 2 application.
when user logged in still has access route /login. best way avoid case ?
i tried redirect user if wants login, didn't works, thought.
public function loginaction() { if (!$this->get('security.context')->isgranted('role_user')) { // not logged in ... code ... .. . } else { // logged in $this->redirect($this->generateurl('hereismyroutename')); } }
i solved on own, problem have return redirect.
return $this->redirect($this->generateurl('hereismyroutename'));
Comments
Post a Comment