Redirect the user after determining they are locked out.

@param  \Illuminate\Http\Request  $request
@return \Illuminate\Http\RedirectResponse
191309
protected function sendLockoutResponse(Request $request)
    {
        $seconds = $this->limiter()->availableIn(
            $this->throttleKey($request)
        );

        $message = Lang::get('auth.throttle', ['seconds' => $seconds]);

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

        if ($request->expectsJson()) {
            return api([], 422, $message);
        }

        return redirect()->back()
            ->withInput($request->only($this->username(), 'remember'))
            ->withErrors($errors);
    }
193703
public function store(Request $request)
    {
        $this->validate($request, Role::$rules, Role::$messages);

        $this->createEntry(Role::class, $request->all());

        return redirect_to_resource();
    }
249130
public function authenticated(Request $request, $user)
    {
        if ($user->is_blocked || ! $user->is_activated) {
            if ($user->is_blocked) {
                $message = 'Your account is currently banned from accessing the site!';
            } else {
                $message = 'Your account is not yet activated!';
            }
            $this->guard()->logout();
            flash()->error($message);

            return redirect()->route('administrator.login')->withErrors($message);
        }

        return redirect()->intended($this->redirectPath);
    }
94647
public function forceunlockAction(Request $request)
    {
        // get request parameters
        $eid = (int) $request->get('eid');
        $language = $request->get('language');

        // get helpers from container
        $elementService = $this->get('phlexible_element.element_service');
        $lockManager = $this->get('phlexible_element.element_lock_manager');

        // get element data object
        $element = $elementService->findElement($eid);

        $lockManager->unlock($element);

        return new ResultResponse(true, 'Lock removed.');
    }
386825
public function deny(Request $request)
    {
        $authRequest = $this->getAuthRequestFromSession($request);

        if (is_array($uri = $authRequest->getClient()->getRedirectUri())) {
            $uri = Arr::first($uri);
        }

        $separator = $authRequest->getGrantTypeId() === 'implicit' ? '#' : '?';

        return $this->response->redirectTo(
            $uri.$separator.'error=access_denied&state='.$request->input('state')
        );
    }
197688
public function store(Request $request)
    {
        $this->validate($request, $this->validationRules($this->resource));
        $entry = $this->entriesRepository->create($request, $this->resource);

        return redirect('admin/' . $this->resource->slug)->with('success', 'Added');
    }
801614
public function onLogoutSuccess(Request $request)
    {
        $resourceOwnerToken = $this->session->get('claroline.oauth.resource_owner_token');
        $redirectUrl = $this->router->generate('claro_index', [], true);
        if (!empty($resourceOwnerToken)) {
            try {
                $resourceOwnerName = str_replace('_', '', ucwords($resourceOwnerToken['resourceOwnerName'], '_'));
                $resourceOwner = $this->resourceOwnerFactory->{'get'.$resourceOwnerName.'ResourceOwner'}();
                if ($resourceOwnerName === 'Office365' || $resourceOwnerName === 'WindowsLive') {
                    return $resourceOwner->logout($redirectUrl);
                }
                $resourceOwner->revokeToken($resourceOwnerToken['token']);
            } catch (AuthenticationException $e) {
                // Do nothing
            }
        }

        return new RedirectResponse($redirectUrl);
    }
285870
public function dispatch(Request $request)
    {
        $this->authorize($request);

        return $this->next->dispatch($request);
    }
878985
public function resetPassword(Request $request)
  {
    if (Get::has('token')) {
      $provider = $this->provider;
      $verified = $this->verify(Get::key('token'), $provider, $this->musk());

      if (isset($verified->id)) {
        $request->rules = $this->rules();
        $request->validate();

        $this->updatePassword($request, $verified);
        return $this->success($verified);
      }
    }

    Redirect::back()->with('error', 'Token is invalid or has expired.', 200);
  }
745349
public function postReset(Request $request) {

        $this->validate($request, [
            'token'    => 'required',
            'email'    => 'required|email',
            'password' => 'required|confirmed|min:6',
        ]);

        $credentials = $request->only(
            'email', 'password', 'password_confirmation', 'token'
        );

        $response = Password::reset($credentials, function ($user, $password) {
            $this->resetPassword($user, $password);
        });

        switch ($response)
        {
            case Password::PASSWORD_RESET:
                //return redirect($this->redirectPath())->with('status', trans($response));
                return view('usermanagement::frontend.'.$this->frontend_template_name.'.password.password_reset_confirmation', [
                    'title'     => 'Password Reset Confirmed',
                    'email'     => $request->input('email'),
                    'username'  => Auth::user()->name,
                ]);

            default:
                return redirect()->back()
                    ->withInput($request->only('email'))
                    ->withErrors(['email' => trans($response)]);
        }
    }
1086742
public function login(Request $request)
    {
        $form = $this->form(new LoginForm());
        $form->handleRequest($request);

        if ($form->isValid()) {
            if ($this->attemptLogin($request, $form)) {
                return $this->sendLoginResponse($request);
            }
        }

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        $this->incrementLoginAttempts($request);

        $this->sendFailedLoginResponse($request);
    }
112984
public function onLogoutSuccess(Request $request)
    {
        $jsonPolicy = new JsonResponsePolicy();

        if ($jsonPolicy->isAcceptable($request)) {
            return new JsonResponse([
                'error' => 0,
                'url' => $this->targetUrl,
            ]);
        } else {
            return $this->httpUtils->createRedirectResponse($request, $this->targetUrl);
        }
    }
98809
protected function sendLockoutResponse (Request $request)
    {


        $seconds = app (RateLimiter::class)->availableIn (
            $this->getThrottleKey ($request)
        );

        return OCLog::error ('AUTH-003', trans ('HCACL::users.errors.to_many_attempts', ['seconds' => $seconds]));
    }
1260026
public function login( Request $request )
	{
		$this->validateLogin( $request );

		// If the class is using the ThrottlesLogins trait, we can automatically throttle
		// the login attempts for this application. We'll key this by the username and
		// the IP address of the client making these requests into this application.
		$throttles = $this->isUsingThrottlesLoginsTrait();

		if ( $throttles && $lockedOut = $this->hasTooManyLoginAttempts( $request ) )
		{
			$this->fireLockoutEvent( $request );

			// return $this->sendLockoutResponse( $request );
		}

		$credentials = $this->getCredentials( $request );
		if ( Acct::guard( $this->getGuard() )->attempt( $credentials, $request->has( 'remember' ) ) )
			return $this->handleUserWasAuthenticated( $request, $throttles );

		// If the login attempt was unsuccessful we will increment the number of attempts
		// to login and redirect the user back to the login form. Of course, when this
		// user surpasses their maximum number of attempts they will get locked out.
		if ( $throttles && !$lockedOut )
			$this->incrementLoginAttempts( $request );

		return $this->sendFailedLoginResponse( $request );
	}
150249
public function logout(Request $request)
    {
        $this->guard()->logout();

        $request->session()->flush();

        $request->session()->regenerate();

        return redirect('/')
            ->with('flash_notice', trans('HCACL::users.success.logout'));
    }
376374
public function register(Request $request)
    {
        $this->validator($request->all())->validate();

        event(new Registered($user = $this->create($request->all())));

        $this->guard()->login($user);

        return $this->registered($request, $user)
                        ?: redirect($this->redirectPath());
    }
1142185
protected function sendLoginResponse(Request $request)
    {
        $request->session()->regenerate();

        $this->clearLoginAttempts($request);

        return $this->authenticated($request, $this->guard()->user())
                ?: redirect()->intended($this->redirectPath());
    }