Use the correct backpath to redirect operator after login

This commit is contained in:
Dmitriy Simushev 2014-11-05 10:46:56 +00:00
parent 82a4d7a2a2
commit 3984c260b0

View File

@ -287,8 +287,17 @@ class Application implements RouterAwareInterface, AuthenticationManagerAwareInt
return new Response('Forbidden', 403); return new Response('Forbidden', 403);
} }
// Operator is not logged in. Redirect him to the login page. // Operator is not logged in. Use the correct backpath to redirect him
$_SESSION['backpath'] = $request->getUri(); // operator after login.
if ($request->attributes->get('_route') == 'users_update') {
// Do not use "users" client application gateway as the backpath.
// Use the awaiting visitors page instead.
$_SESSION['backpath'] = $this->getRouter()->generate('users');
} else {
// Just use the current URI as the backpath.
$_SESSION['backpath'] = $request->getUri();
}
// Redirect the operator to the login page.
$response = new RedirectResponse($this->getRouter()->generate('login')); $response = new RedirectResponse($this->getRouter()->generate('login'));
return $response; return $response;