Send the response after the user was authenticated.

@param  Request $request
@param  bool $throttles
@return Response
346786
protected function handleUserWasAuthenticated( Request $request, $throttles )
	{
		if ( $throttles )
			$this->clearLoginAttempts( $request );

		if ( method_exists( $this, 'authenticated' ) )
			return $this->authenticated( $request, Acct::guard( $this->getGuard() )->acct() );

		return Redirect::intended( $this->redirectPath() );
	}
464439
public function send(Request $request)
    {
        $response     = new PutSchemaResponse();
        $httpRequest  = $this->createHttpRequest($request);

        $this->client->send($httpRequest);

        return $response;
    }
911508
protected function handleUserWasAuthenticated(Request $request, $throttles) {

        if ($throttles) {
            $this->clearLoginAttempts($request);
        }

        // I've succeeded avoiding CASE statements and ELSE clauses in conditionals. However, this time is different,
        // because I've had a hard time flowing through my 2FA flow. Turns out that expressing it this way, I've
        // removed some code! Once in a while, gotta bite the bullet, I suppose. Note my guilt!

        // Is config set for admin 2FA login?
        if ($this->twoFactorAuthHelper->isAuthConfigEnableTwoFactorAuthAdminLogin()) {

            // All users must go through the 2FA admin login process, so no skipping 2FA!

        } else {

            // The admin can still assign a user to go through the 2FA process, despite the global setting
            if ($this->twoFactorAuthHelper->isUserTwoFactorAuthEnabled(AUTH::user()->id)) {

                // Ah, this specific user must go through the 2FA admin login process

            } else {

                // We're here? Then no 2FA login required for admin login

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

                // Onward to the front-end
                if (Config::get('lasallecmsfrontend.frontend_redirect_to_this_view_when_user_successfully_logged_in_to_front_end') != '') {
                    return redirect(Config::get('lasallecmsfrontend.frontend_redirect_to_this_view_when_user_successfully_logged_in_to_front_end'));
                }

                return Redirect::route('home');
            }
        }


        // Oh, well, 2FA it is!


        // Um, maybe not. If the cookie exists, then no 2FA
        if ($this->twoFactorAuthHelper->isCookieExists()) {

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

            // Onward to the front-end
            return Redirect::route('home');
        }


        // Does user have their country code and phone number specified?
        if (!$this->twoFactorAuthHelper->existstUserCountryCodeAndPhoneNumber(AUTH::user()->id)) {

            // User is actually logged in at this point, so must log 'em out
            Auth::logout();

            return redirect()->route('auth.login')
                ->withInput($request->only('email'))
                ->withErrors([
                    'email' => 'You do not have a country code and/or a phone number for Two Factor Authorization. Please contact your administrator.',
                ]);
        }

        // Save the user's ID, as the user is actually logged in at this point
        $this->twoFactorAuthHelper->setUserIdSessionVar(AUTH::user()->id);

        // User is actually logged in at this point, so must log 'em out
        Auth::logout();

        // Perform 2FA for login
        $this->twoFactorAuthHelper->doTwoFactorAuthLogin($request->session()->get('user_id'));

        return view('usermanagement::frontend.'.$this->frontend_template_name.'.login.two_factor_auth', [
            'title' => 'Login Enter 2FA Code',
        ]);
    }
1135138
public function afterSend($request, $response)
    {
        $event = new RequestEvent();
        $event->request = $request;
        $event->response = $response;
        $this->trigger(self::EVENT_AFTER_SEND, $event);
    }
770582
public function send(Request $request)
    {
        $response = new SearchResponse();
        $rpbReq   = $this->createRpbMessage($request);
        $rpbResp  = $this->client->send($rpbReq, RiakMessageCodes::SEARCH_QUERY_REQ, RiakMessageCodes::SEARCH_QUERY_RESP);

        if ( ! $rpbResp instanceof RpbSearchQueryResp) {
            return $response;
        }

        $response->numFound = $rpbResp->num_found;
        $response->maxScore = $rpbResp->max_score;

        if ( ! $rpbResp->hasDocs()) {
            return $response;
        }

        $response->docs = array_map([$this, 'docToArray'], $rpbResp->docs);

        return $response;
    }
105667
public function extend($throttle)
    {
        if (is_callable($throttle)) {
            $throttle = call_user_func($throttle, $this->container);
        }

        $this->throttles->push($throttle);
    }
161700
protected function sendFailedLoginResponse(Request $request)
    {
        $credentials = $this->credentials($request);

        $user = User::where('email', $credentials['email'])->first();
        if (!$user) {
            $error = __('This user was not found.');
        } elseif (!$user->activated) {
            $error = __('This user is not activated.');
        } else {
            $error = __('The password is incorrect.');
        }

        $errors = [$this->username() => $error];

        if ($request->expectsJson()) {
            return response()->json($errors, 422);
        }

        return redirect()->back()
            ->withInput($request->only($this->username(), 'remember'))
            ->withErrors($errors);
    }
27463
public function send(Request $request)
    {
        $response = new IndexQueryResponse();
        $rpbReq   = $this->createRpbMessage($request);
        $socket   = $this->client->emit($rpbReq, RiakMessageCodes::INDEX_REQ);
        $iterator = new ProtoStreamIterator($this->client, $socket, RiakMessageCodes::INDEX_RESP);

        $response->iterator = new ProtoIndexQueryResponseIterator($request, $iterator);

        return $response;
    }
883881
public function handle(Request $request)
    {
        if (!$this->booted) {
            $this->bootstrap();
        }

        $this->request = $request;
        $response = new Response();
        return($response);
    }
1353315
public function send(Request $request)
    {
        $response     = new PutResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $code         = $httpResponse->getStatusCode();

        if ( ! isset($this->validResponseCodes[$code])) {
            throw RiakTransportException::unexpectedStatusCode($code);
        }

        return $response;
    }
1305804
public function send(Request $request)
    {
        $response     = new GetSchemaResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);

        $response->name    = $request->name;
        $response->content = (string) $httpResponse->getBody();

        return $response;
    }
1328229
public function send(Request $request)
    {
        $response     = new SearchResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $json         = $httpResponse->json();
        $result       = $json['response'];

        $response->docs     = $result['docs'];
        $response->numFound = $result['numFound'];
        $response->maxScore = $result['maxScore'];
        $response->docs     = array_map([$this, 'docToArray'], $result['docs']);

        return $response;
    }
439934
protected function sendRequest(Request $request): Response
    {
        // Set password authentication for request.
        if ($this->password !== null) {
            $request->authenticate($this->password);
        }

        $this->send((string) $request);
        $response = new Response($this->get());
        return $response;

    }
1219319
protected function doRequest($controller, Request $request, array $qs = array())
    {
        $request->fromUrl($this->getApiEndpoint($controller).'?'.http_build_query($qs));
        $request->addHeader('Authorization: Basic '.$this->options['key']);
        $request->addHeader('Accept: text/json');

        $this->client->send($request, $response = new JsonResponse());

        $content = $response->getContentJson(true);

        if (!in_array($content['ReturnCode'], array(self::EXECCODE_SUCCESS, self::EXECCODE_OPERATION_REFUSED))) {
            $e = new RequestException(print_r(array_merge($content, array('url' => $request->getUrl(), 'content' => $request->getContent())), true));
            $e->setRequest($request);
            throw $e;
        }

        return $response;
    }
1285618
public function sendEmailAction(Request $request)
    {
        $username = $request->request->get('username');

        /** @var $user UserInterface */
        $user = $this->get('fos_user.user_manager')->findUserByUsernameOrEmail($username);

        if (null === $user) {
            return $this->render('BaconUserBundle:Resetting:request.html.twig', array(
                'invalid_username' => $username
            ));
        }

        if ($user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
            return $this->render('FOSUserBundle:Resetting:passwordAlreadyRequested.html.twig');
        }

        if (null === $user->getConfirmationToken()) {
            /** @var $tokenGenerator \FOS\UserBundle\Util\TokenGeneratorInterface */
            $tokenGenerator = $this->get('fos_user.util.token_generator');
            $user->setConfirmationToken($tokenGenerator->generateToken());
        }

        $this->get('fos_user.mailer')->sendResettingEmailMessage($user);
        $user->setPasswordRequestedAt(new \DateTime());
        $this->get('fos_user.user_manager')->updateUser($user);

        return new RedirectResponse($this->generateUrl('fos_user_resetting_check_email',
            array('email' => $this->getObfuscatedEmail($user))
        ));
    }
865716
public function logout(Request $request)
    {
        $content = json_decode($request->getContent(), true);

        $securityToken = $this->security->getToken();
        $user          = $securityToken->getUser();
        $accessToken   = $securityToken->getOAuthToken();
        $refreshToken  = Arr::get($content, 'refresh_token');

        $this->session->set('user', null);

        if (! $refreshToken) {
            return new Response('Refresh token not provided', 422);
        }

        try {
            $this->expireAccessToken($accessToken);
            $this->expireRefreshToken($refreshToken, $user);
        } catch (OutOfBoundsException $e) {
            return new Response($e->getMessage(), 422);
        }

        return new Response('', 200);
    }
350372
function throttleMiddleware (request, response, next) {
    var ip = null

    if (config.useCustomHeader && request.headers[config.useCustomHeader]) {
      ip = request.headers[config.useCustomHeader]
    } else {
      ip = request.headers['x-forwarded-for'] ||
        request.connection.remoteAddress ||
        request.socket.remoteAddress ||
        request.connection.socket.remoteAddress || ''

      ip = ip.split(',')[0]
      if (!ipRegex().test(ip) || ip.substr(0, 7) === '::ffff:' || ip === '::1') {
        ip = '127.0.0.1'
      } else {
        ip = ip.match(ipRegex())[0]
      }
    }

    Throttle
      .findOneAndUpdate({ip: ip}, { $inc: { hits: 1 } }, { upsert: false })
      .exec(function (error, throttle) {
        if (errHandler(response, next, error)) { return }
        if (!throttle) {
          throttle = new Throttle({
            createdAt: new Date(),
            ip: ip
          })
          throttle.save(function (error, throttle) {
            // THERE'S NO ERROR, BUT THROTTLE WAS NOT SAVE
            if (!throttle && !error) {
              error = new Error('Error checking rate limit.')
            }

            if (errHandler(response, next, error)) { return }

            respondWithThrottle(request, response, next, throttle)
          })
        } else {
          respondWithThrottle(request, response, next, throttle)
        }
      })
  }