From 3984c260b0f504004b44a00ff38dfef0b690ca21 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 5 Nov 2014 10:46:56 +0000 Subject: [PATCH] Use the correct backpath to redirect operator after login --- src/mibew/libs/classes/Mibew/Application.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mibew/libs/classes/Mibew/Application.php b/src/mibew/libs/classes/Mibew/Application.php index 3a5ac1de..7cddbce7 100644 --- a/src/mibew/libs/classes/Mibew/Application.php +++ b/src/mibew/libs/classes/Mibew/Application.php @@ -287,8 +287,17 @@ class Application implements RouterAwareInterface, AuthenticationManagerAwareInt return new Response('Forbidden', 403); } - // Operator is not logged in. Redirect him to the login page. - $_SESSION['backpath'] = $request->getUri(); + // Operator is not logged in. Use the correct backpath to redirect him + // 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')); return $response;