Get the failed login response instance.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\RedirectResponse
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);
    }
1310478
public function postReset(Request $request)
    {

        $form = FormBuilder::create('Distilleries\Expendable\Http\Forms\Login\Forgotten');
        if ($form->hasError())
        {
            return $form->validateAndRedirectBack();
        }

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

        // If the password was successfully reset, we will redirect the user back to
        // the application's home authenticated view. If there is an error we can
        // redirect them back to where they came from with their error message.
        return $response == Password::PASSWORD_RESET
            ? redirect()->to(action('\\'.get_class($this).'@getIndex'))
            : redirect()->back()->with('error', trans($response));

    }
155702
private function createRedirectResponse(Request $request)
    {
        $url = $this->loginUrl.'?'.http_build_query([
            'redirect_to' => $request->getUri(),
            'reauth'      => 0,
        ]);

        return RedirectResponse::create($url, 302);
    }
1175086
public function postLogin(Request $request)
    {
        // Validate the Form Data
        $result = $this->validate($request, [
            'email' => 'required',
            'password' => 'required'
        ]);

        // Assemble Login Credentials
        $credentials = [
            'email' => trim($request->get('email')),
            'password' => $request->get('password'),
        ];
        $remember = (bool)$request->get('remember', false);

        // Attempt the Login
        $result = $this->authManager->authenticate($credentials, $remember);

        // Return the appropriate response
        $path = session()->pull('url.intended', route('dashboard'));
        return $result->dispatch($path);
    }
867830
public function getRedirectFor(Request $request)
    {
        $redirects = $this->redirector->getRedirectsFor($request);

        collect($redirects)->each(function ($redirects, $missingUrl) {
            $this->router->get($missingUrl, function () use ($redirects, $missingUrl) {
                $redirectUrl = $this->determineRedirectUrl($redirects);
                $statusCode = $this->determineRedirectStatusCode($redirects);

                event(new RouteWasHit($redirectUrl, $missingUrl, $statusCode));

                return redirect()->to(
                    $redirectUrl,
                    $statusCode
                );
            });
        });

        try {
            return $this->router->dispatch($request);
        } catch (Exception $e) {
            event(new RedirectNotFound($request));

            return;
        }
    }
11580
public function loginAction(Request $request)
        {

            if ($this->container->getParameter('database_password') === null) {
                return $this->redirect($this->generateUrl('install_license'));
            } else {
                $request = $this->getRequest();
                $session = $request->getSession();

                // get the login error if there is one
                if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
                    $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
                } else {
                    $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
                }


                return $this->render('SlashworksBackendBundle:Security:login.html.twig', array(
                    'last_username' => $session->get(SecurityContext::LAST_USERNAME),
                    'error'         => $error,
                ));
            }
        }
500679
public function postLogin(Request $request)
    {
        $credentials = $request->only([$this->username(), 'password']);

        /** @var \Illuminate\Validation\Validator $validator */
        $validator = Validator::make($credentials, [
            $this->username()   => 'required',
            'password'          => 'required',
        ]);

        if ($validator->fails()) {
            return back()->withInput()->withErrors($validator);
        }

        if ($this->guard()->attempt($credentials)) {
            return $this->sendLoginResponse($request);
        }

        return back()->withInput()->withErrors([
            $this->username() => $this->getFailedLoginMessage(),
        ]);
    }
169800
public function callback(Request $request)
    {
        if ($request->has('error')) {
            switch ($request->get('error')) {
                case 'access_denied':
                    abort(401);
                    break;
                case 'temporarily_unavailable':
                    abort(503);
                    break;
                case 'invalid_request':
                case 'unauthorized_client':
                case 'unsupported_response_type':
                case 'invalid_scope':
                case 'server_error':
                default:
                    abort($request->server->get('REDIRECT_STATUS', 500));
                    break;
            }
        }

        $code = $request->get('code');
        $http = new Client();

        try {
            $response = $http->post(config('openid.server') . '/oauth/token', [
                'form_params' => [
                    'grant_type'    => 'authorization_code',
                    'client_id'     => config('openid.client.id'),
                    'client_secret' => config('openid.client.secret'),
                    'redirect_uri'  => route('openid.callback'),
                    'code'          => $code,
                ],
            ]);

            $this->checkError($response);
            $response = json_decode($response->getBody());

            session([
                'openid_token'  => $response->id_token,
                'access_token'  => $response->access_token,
                'refresh_token' => $response->refresh_token,
                'expires_at'    => Carbon::now()->addSeconds($response->expires_in),
            ]);
        } catch (\Exception $exception) {
            if ($exception instanceof ServerException || $exception instanceof ClientException) {
                $this->checkError($exception->getResponse());
            }

            abort($exception->getCode() !== 0 ? $exception->getCode() : 500);
        }

        return redirect()->intended();
    }
1254276
public function getLogout(Request $request)
    {
        // Terminate the user's current session.  Passing true as the
        // second parameter kills all of the user's active sessions.
        $result = $this->authManager->logout(null, null);

        // Return the appropriate response
        return $result->dispatch(route('dashboard'));
    }
1139162
public function logout(Request $request)
    {
        $this->guard()->logout();

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

        return redirect(route('admin.login'));
    }
991924
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.
        if ($lockedOut = $this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

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

        $credentials = $this->credentials($request);

        if ($this->guard()->attempt($credentials, $request->has('remember'))) {
            return $this->sendLoginResponse($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.
        if (! $lockedOut) {
            $this->incrementLoginAttempts($request);
        }

        return $this->sendFailedLoginResponse($request);
    }
1171862
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.
        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

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

        if ($this->attemptLogin($request)) {
            return $this->sendLoginResponse($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);

        return $this->sendFailedLoginResponse($request);
    }
1064596
public function reset(Request $request)
    {
        $data = new PasswordResetData();

        $form = $this->form(new PasswordResetForm($data));
        $form->handleRequest($request);

        if ($form->isNotValid()) {
            return back()->withErrors($form->errors()->all());
        }

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

        return $response == Password::PASSWORD_RESET
            ? $this->sendResetResponse($request, $response)
            : $this->sendResetFailedResponse($request, $response);
    }
1341171
public function resolve(Request $request) : Response {
        if($request->expectsJson()) {
            return $this->json();
        }

        return $this->redirect();
    }
1009447
public function postLogin(\Illuminate\Http\Request $request)
	{
		$this->validate($request, [
			'username' => 'required', 'password' => 'required',
		], [ 
			'required' => trans('common::admin.validation.required')
		]);
		
		$return_url = $request->input('return_url', '');
		if ($return_url == '') $return_url = null;

		$credentials = $request->only('username', 'password');
		
		if ($this->auth->attempt($credentials, $request->has('remember')))
		{
			if ($request->ajax())
			{
				return [ 'success' => true, 'token' => csrf_token() ];
			}
			
			return ($return_url != null ? redirect($return_url) : redirect()->route('admin-home'));
		}
		
		if ($request->ajax() || $request->wantsJson())
		{
			throw new \Illuminate\Http\Exception\HttpResponseException(
				new \Illuminate\Http\JsonResponse([ 'username' => 'Wrong username or password' ], 422)
			);
		}
		
		return redirect(route('admin-login') . '?return_url=' . urlencode($return_url))
			->withInput($request->only('username', 'remember'))
			->withErrors([
				'username' => 'Wrong username or password',
			]);
	}
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);
    }
995484
public function postLogin(Request $request)
	{
		$this->validate($request, [
			'email' => 'required|email', 'password' => 'required',
		]);

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

		if ($this->auth->attempt($credentials, $request->has('remember')))
		{
			return redirect()->intended($this->redirectPath());
		}

		return redirect($this->loginPath())
					->withInput($request->only('email', 'remember'))
					->withErrors([
						'email' => $this->getFailedLoginMessage(),
					]);
	}