public function connectAction(Request $request)
    {
        $connect = $this->container->getParameter('hwi_oauth.connect');
        $hasUser = $this->getUser() ? $this->isGranted($this->container->getParameter('hwi_oauth.grant_rule')) : false;

        $error = $this->getErrorForRequest($request);

        // if connecting is enabled and there is no user, redirect to the registration form
        if ($connect && !$hasUser && $error instanceof AccountNotLinkedException) {
            $key = time();
            $session = $request->getSession();
            if (!$session->isStarted()) {
                $session->start();
            }

            $session->set('_hwi_oauth.registration_error.'.$key, $error);

            return $this->redirectToRoute('hwi_oauth_connect_registration', ['key' => $key]);
        }

        if ($error) {
            if ($error instanceof AuthenticationException) {
                $error = $error->getMessageKey();
            } else {
                $error = $error->getMessage();
            }
        }

        return $this->render('@HWIOAuth/Connect/login.html.twig', [
            'error' => $error,
        ]);
    }
public function connectAction(Request $request)
    {
        $connect = $this->container->getParameter('hwi_oauth.connect');
        $hasUser = $this->getUser() ? $this->isGranted($this->container->getParameter('hwi_oauth.grant_rule')) : false;

        $error = $this->getErrorForRequest($request);

        // if connecting is enabled and there is no user, redirect to the registration form
        if ($connect && !$hasUser && $error instanceof AccountNotLinkedException) {
            $key = time();
            $session = $request->getSession();
            if (!$session->isStarted()) {
                $session->start();
            }

            $session->set('_hwi_oauth.registration_error.'.$key, $error);

            return $this->redirectToRoute('hwi_oauth_connect_registration', ['key' => $key]);
        }

        if ($error) {
            if ($error instanceof AuthenticationException) {
                $error = $error->getMessageKey();
            } else {
                $error = $error->getMessage();
            }
        }

        return $this->render('@HWIOAuth/Connect/login.html.twig', [
            'error' => $error,
        ]);
    }
public function connectAction ( Request $ request ) { $ connect = $ this -> container -> getParameter ( 'hwi_oauth.connect' ) ; $ hasUser = $ this -> getUser ( ) ? $ this -> isGranted ( $ this -> container -> getParameter ( 'hwi_oauth.grant_rule' ) ) : false ; $ error = $ this -> getErrorForRequest ( $ request ) ; // if connecting is enabled and there is no user, redirect to the registration form if ( $ connect && ! $ hasUser && $ error instanceof AccountNotLinkedException ) { $ key = time ( ) ; $ session = $ request -> getSession ( ) ; if ( ! $ session -> isStarted ( ) ) { $ session -> start ( ) ; } $ session -> set ( '_hwi_oauth.registration_error.' . $ key , $ error ) ; return $ this -> redirectToRoute ( 'hwi_oauth_connect_registration' , [ 'key' => $ key ] ) ; } if ( $ error ) { if ( $ error instanceof AuthenticationException ) { $ error = $ error -> getMessageKey ( ) ; } else { $ error = $ error -> getMessage ( ) ; } } return $ this -> render ( '@HWIOAuth/Connect/login.html.twig' , [ 'error' => $ error , ] ) ; }
Action that handles the login 'form'. If connecting is enabled the
user will be redirected to the appropriate login urls or registration forms.

@param Request $request

@throws \LogicException

@return Response
Action that handles the login form . If connecting is enabled the user will be redirected to the appropriate login urls or registration forms .