Returns the Form object for the login form

@access protected
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\WebRequest $request
@param \Zepi\Turbo\Response\Response $response
@return \Zepi\Web\UserInterface\Form\Form
196374
protected function createForm(Framework $framework, WebRequest $request, Response $response)
    {
        // Create the form
        $form = new Form('login', $request->getFullRoute('login'), 'post');
        
        // Add the user data group
        $errorBox = new ErrorBox(
            'login-errors',
            1
        );
        $form->addPart($errorBox);
        
        $origin = '';
        if ($request->hasParam('_origin')) {
            $origin = $request->getParam('_origin');
        }
        
        $helpText = '';
        if ($this->getSetting('accesscontrol.allowRenewPassword')) {
            $helpText = $this->translate('Lost your password? <a href="%link%">Renew it here.</a>', '\\Zepi\\Web\\AccessControl', array(
                'link' => $request->getFullRoute('request-new-password')
            ));
        }
        
        // Add the user data group
        $group = new Group(
            'user-data',
            $this->translate('User data', '\\Zepi\\Web\\AccessControl'),
            array(
                new Text(
                    'username',
                    $this->translate('Username', '\\Zepi\\Web\\AccessControl'),
                    true
                ),
                new Password(
                    'password',
                    $this->translate('Password', '\\Zepi\\Web\\AccessControl'),
                    true,
                    '',
                    $helpText
                ),
                new Hidden(
                    'origin',
                    $origin
                )
            ),
            10
        );
        $form->addPart($group);
        
        // Add the submit button
        $buttonGroup = new ButtonGroup(
            'buttons',
            array(
                new Submit(
                    'submit',
                    $this->translate('Login', '\\Zepi\\Web\\AccessControl')
                )
            ),
            100
        );
        $form->addPart($buttonGroup);
        
        return $form;
    }
593612
public function post2FALogin(Request $request) {

        $userId = $request->session()->get('user_id');

        // Did the user take too much time to fill out the form?
       if ($this->twoFactorAuthHelper->isTwoFactorAuthFormTimeout($userId)) {
           return view('usermanagement::frontend.'.$this->frontend_template_name.'.login.login', [
               'title' => 'Login',
               ])
               ->withErrors([
                   'Two Factor Authorization' => 'Your two factor authorization code expired. Please re-login.'
               ]);
       }

        // Is the code correct?
        // If not, go back to the 2FA form with an error message
        if (!$this->twoFactorAuthHelper->isInputtedTwoFactorAuthCodeCorrect($userId)) {
            return view('usermanagement::frontend.'.$this->frontend_template_name.'.login.two_factor_auth', [
                'title' => 'Login Enter 2FA Code',
            ])
                ->withErrors([
                    'Two Factor Authorization' => 'Your entered an incorrect two factor authorization code. Please try again.'
                ]);
        }

        // 2FA successful!

        // Clear the user's 2FA code
        $this->twoFactorAuthHelper->clearUserTwoFactorAuthFields($userId);

        // Update the user's last_login fields
        $this->twoFactorAuthHelper->updateUserRecordWithLastlogin($userId);

        // Manually login user
        Auth::loginUsingId($request->session()->get('user_id'));

        // Clear the 'user_id' session variable
        $this->twoFactorAuthHelper->clearUserIdSessionVar();


        // Set the cookie, and onward and forward to the frontend!

        // Ah ah ah! Instantiating a new response view and returning it is causing a message to display
        // before the actual view is rendered. This message looks like cookie information, but it displays
        // whether or not a cookie is created. So... I'm going to see if we need a cookie, and if not,
        // return the view as usual.

        if ((!$this->twoFactorAuthHelper->isCookieExists()) && (config('lasallecmsusermanagement.auth_2fa_cookie_enable'))) {

            // Create the cookie...
            $view = redirect()->intended($this->twoFactorAuthHelper->redirectPathUponSuccessfulFrontendLogin());
            $response = new \Illuminate\Http\Response($view);
            $response = $this->twoFactorAuthHelper->setCookie($response);
            return $response;
        }

        // Oh, no cookie writing at all...
        return redirect()->intended($this->twoFactorAuthHelper->redirectPathUponSuccessfulFrontendLogin());
     }
1049331
public function prepareResponse( $request, $response )
	{
		if ( $response instanceof PsrResponseInterface )
			$response = ( new HttpFoundationFactory )->createResponse( $response );
		elseif ( !$response instanceof SymfonyResponse )
			$response = new Response( $response );

		return $response->prepare( $request );
	}
1229997
public function execute(Framework $framework, RequestAbstract $request, Response $response, $value = null)
    {
        $permissions = array();
        foreach ($value as $accessLevel) {
            $parts = explode('\\', $accessLevel);

            if ($parts[1] === 'Group' && count($parts) === 3) {
                $uuid = $parts[2];
                
                $groupPermissions = $this->accessControlManager->getPermissionsForUuid($uuid);
                if ($groupPermissions !== false) {
                    foreach ($groupPermissions as $groupPermission) {
                        $permissions[] = $groupPermission;
                    }
                }
            } else {
                $permissions[] = $accessLevel;
            }
        }
        
        $permissions = array_unique($permissions);
        
        return $permissions;
    }
1159223
protected function addCookieToResponse($request, $response)
    {
        $config = config('session');

        $response->headers->setCookie(
            new Cookie(
                'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']),
                $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null
            )
        );

        return $response;
    }
1355992
public function execute(Framework $framework, CliRequest $request, Response $response)
    {
        $output = 'Activated modules:' . PHP_EOL;
        $output .= '==================' . PHP_EOL . PHP_EOL;
        $moduleManager = $framework->getModuleManager();
        foreach ($moduleManager->getModules() as $namespace => $module) {
            $properties = $moduleManager->getModuleProperties($module->getDirectory());
            $info = $properties->module;
            
            $output .= '- ' . $info->name . ' ' . $info->version . ' (' . $namespace . '):' . PHP_EOL;
            $output .= '  ' . $info->description . PHP_EOL . PHP_EOL;
        }
        
        $response->setOutputPart('modules', $output);
    }
69254
public function authenticate(Request $request, Response $response)
    {
        $fields = $this->_config['fields'];
        if (!$this->_checkFields($request, $fields)) {
            return false;
        }
        return $this->findAdUser($request->data[$fields['username']], $request->data[$fields['password']]);
    }
201152
public function dispatch(Request $request, Response $response) {
		$module = ucfirst($request->module);
		$controller = ucfirst($request->controller);
		$action = ucfirst($request->action);
		$response->setTemplate($controller . '/' . $action);
		$response->setTemplatePath(APP_PATH . 'Module/' . $module . '/View/');
		if (!empty($request->extension)) {
			$response->mimeType($request->extension);
		}
		try {
			$code = self::isValid($module, $controller, $action);
			if ($code === self::ROUTE_VALID) {
				$className = EntryUtil::controller($module, $controller);
				$clazz = Container::getInstance()->get($className);
				$actionName = $action . 'Action';
				$result = $clazz->$actionName($request, $response);
				if ($result !== null) {
					$response->result = $result;
				}
			} else {
				// Not found
				$request->status = $code;
			}
		} catch (\Throwable $e) {
			$request->status = $e;
		}
		$this->executeInterceptor('after', $request, $response);
		$request->end();
		$response->end();
		unset($request, $response);
	}
56772
protected function validateData(Framework $framework, $username, $email, $password, $tos)
    {
        // If the given username already exists
        if ($this->userManager->hasUserForUsername($username)) {
            return $this->translate('The inserted username is already in use. Please select a new username.', '\\Zepi\\Web\\AccessControl');
        }
        
        // Email
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            return $this->translate('Please insert a valid email address.', '\\Zepi\\Web\\AccessControl');
        }
        
        // Password
        if (strlen($password) < 8) {
            return $this->translate('The password needs at least 8 characters.', '\\Zepi\\Web\\AccessControl');
        }
        
        // ToS
        if (!$tos) {
            return $this->translate('Please accept our terms of service.', '\\Zepi\\Web\\AccessControl');
        }
        
        // Everything is okey
        return true;
    }
406862
public function execute(Framework $framework, WebRequest $request, Response $response)
    {
        $uuid = $request->getRouteParam('uuid');
        
        // If there is a request parameter we need to edit a user. Otherwise we create a new one.
        if (is_string($uuid)) {
            $additionalTitle = $this->translate('Modify user', '\\Zepi\\Web\\AccessControl');
            
            $user = $this->userManager->getUserForUuid($uuid);
        } else {
            $additionalTitle = $this->translate('Add user', '\\Zepi\\Web\\AccessControl');
            
            $user = new User('', '', '', '', array());
        }
        $title = $this->translate('User management', '\\Zepi\\Web\\AccessControl');
        $this->layout->setUser($user);
        
        // Prepare the page
        $this->activateMenuEntry('user-administration');
        $this->setTitle($title, $additionalTitle);
        
        // Process the data
        $result = $this->processFormData($request, $response, $user);
        if ($result === true) {
            // Display the successful saved message
            $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\EditUserFinished', array(
                'title' => $this->getTitle()
            )));
        } else {
            // Display the form
            $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\EditUserForm', array(
                'user' => $user,
                'title' => $this->getTitle(),
                'layout' => $this->layout->getLayout(),
                'layoutRenderer' => $this->getLayoutRenderer()
            )));
        }
    }
999029
protected function addCookieToResponse( $request, $response )
	{
		$config = Config::get( 'session' );
		$response->headers->setCookie( new Cookie( 'XSRF-TOKEN', $request->session()->token(), time() + 60 * 120, $config['path'], $config['domain'], $config['secure'], false ) );

		return $response;
	}
757995
public function transformEarly(Request $request, SymfonyResponse $response)
    {
        $responseModel = $response->getContent();

        if (!$responseModel instanceof ResponseModelInterface) {
            $responseModel = $this->responseModelFactory->createFromContent(
                $response
            );
        }

        $responseModel->setReturnStackTrace($this->isDebug());
        $response->setStatusCode($responseModel->getStatusCode());
        $this->forceStatusCodeHttpOK($request, $response, $responseModel);
        $response = $this->createSerializedResponse(
            $request,
            $response,
            $responseModel
        );

        return $response;
    }
1290348
protected function setUriHeader(Response $response, Request $request)
    {
        $response->header('X-PJAX-URL', $request->getRequestUri());

        return $this;
    }
46859
protected function _handleLoginAction(ServerRequest $request, Response $response)
    {
        $request->allowMethod($this->getConfig('requestMethod'));

        $providerName = $request->getParam('provider');
        $provider = $this->_getService($request)->getProvider($providerName);
        $authUrl = $provider->makeAuthUrl();

        $this->_setRedirectUrl($request);

        return $response->withLocation($authUrl);
    }
1271147
public function doLogin($data, MemberLoginForm $form, HTTPRequest $request)
    {
        /**
         * @var ValidationResult $message
         * @var Member|MemberExtension $member
         */
        $member = $this->checkLogin($data, $request, $message);

        if (!$member) {
            return $this->redirectBack();
        }

        // If we're in grace period, continue to the parent
        if ($member->isInGracePeriod()) {
            return parent::doLogin($data, $form, $request);
        }

        if ($message->isValid()) {
            /** @var Session $session */
            $session = $request->getSession();
            $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.MemberID', $member->ID);
            $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.Data', $data);
            if (!empty($data['BackURL'])) {
                $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.BackURL', $data['BackURL']);
            }

            return $this->redirect($this->link('verify'));
        }

        return $this->redirectBack();
    }
118315
public function requestAction(Request $request)
    {
        $form = $this
            ->createForm(new UserForgotPassType())
            ->handleRequest($request)
        ;

        $obj = $form->getData();

        $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByUsername($obj['search']);
        if ($user === null) {
            $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByEmail($obj['search']);
        }

        if (!$user) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-nosuchuser.html.twig',
                array("search" => $obj))));
            return array('form' => $form->createView());
        } elseif ($user->getRegistrationToken()) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-userinactive.html.twig', array("user" => $user))));
            return array(
                'user' => $user,
                'form' => $form->createView());
        }

        $this->setResetToken($user);

        return $this->redirect($this->generateUrl('fom_user_password_send'));
    }
175219
public function prepareResponse($response)
    {
        $request = \app(Request::class);

        if ($response instanceof Responsable) {
            $response = $response->toResponse($request);
        }

        if ($response instanceof PsrResponseInterface) {
            $response = (new HttpFoundationFactory())->createResponse($response);
        } elseif (! $response instanceof SymfonyResponse) {
            $response = new Response($response);
        } elseif ($response instanceof BinaryFileResponse) {
            $response = $response->prepare(Request::capture());
        }

        return $response->prepare($request);
    }