private function handlePostLogin(Request $request) { $event = new AccessControlEvent($request); $username = trim($request->request->get('username')); $password = $request->request->get('password'); if (!$this->login()->login($username, $password, $event)) { return $this->getLogin($request, true); } // Authentication data is cached in the session and if we can't get it // now, everyone is going to have a bad day. Make that obvious. if (!($token = $this->session()->get('authentication'))) { $this->flashes()->error(Trans::__('general.phrase.error-session-data-login')); return $this->getLogin($request); } // Log in, if credentials are correct. $this->app['logger.system']->info('Logged in: ' . $username, ['event' => 'authentication']); $retreat = $this->session()->get('retreat', ['route' => 'dashboard', 'params' => []]); $response = $this->setAuthenticationCookie($request, $this->redirectToRoute($retreat['route'], $retreat['params']), (string) $token); return $response; }