Bolt\Controller\Backend\Authentication::handlePostLogin PHP Method

handlePostLogin() private method

Handle a login POST.
private handlePostLogin ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response
    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;
    }