LaravelPackages.net
Acme Inc.
Toggle sidebar
sanchescom/lumen-login-throttling

Lumen login throttling.

1.032
1
0.1.0
About sanchescom/lumen-login-throttling

sanchescom/lumen-login-throttling is a Laravel package for lumen login throttling.. It currently has 1 GitHub stars and 1.032 downloads on Packagist (latest version 0.1.0). Install it with composer require sanchescom/lumen-login-throttling. Discover more Laravel packages by sanchescom or browse all Laravel packages to compare alternatives.

Last updated

Lumen Login Throttling

Laravel Login Throttling for Lumen framework

Installing

Require this package, with Composer, in the root directory of your project.

composer require sanchescom/lumen-login-throttling

Usage

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Sanchescom\Foundation\Auth\AuthenticatesUsers;
use Laravel\Lumen\Routing\Controller;

class AuthController extends Controller
{
    use AuthenticatesUsers;

    /** @var int */
    protected $maxAttempts = 3;

    /** @var int */
    protected $decayMinutes = 5;
    
    /**
     * Handle a login request to the application.
     *
     * @param  \Illuminate\Http\Request $request
     *
     * @throws \Illuminate\Validation\ValidationException
     *
     * @return mixed
     */
    public function login(Request $request)
    {
        $this->validateLogin($request);

        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

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

        if ($this->attemptLogin($request)) {
            return $this->sendLoginResponse($request);
        }
        
        $this->incrementLoginAttempts($request);

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

Laravel Login Throttling documentation

Star History Chart