From 1ab9d95b9c1c7ae503209ab02674a8a8be2be048 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 25 Feb 2016 21:26:46 +0000 Subject: [PATCH] Native throttling --- app/Http/Kernel.php | 2 +- app/Http/Routes/AuthRoutes.php | 4 +-- composer.json | 1 - composer.lock | 65 ++-------------------------------- config/app.php | 1 - config/throttle.php | 30 ---------------- 6 files changed, 5 insertions(+), 98 deletions(-) delete mode 100644 config/throttle.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 1622301e..95b1f786 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -59,6 +59,6 @@ class Kernel extends HttpKernel 'ready' => 'CachetHQ\Cachet\Http\Middleware\ReadyForUse', 'setup' => 'CachetHQ\Cachet\Http\Middleware\SetupAlreadyCompleted', 'subscribers' => 'CachetHQ\Cachet\Http\Middleware\SubscribersConfigured', - 'throttling' => 'GrahamCampbell\Throttle\Http\Middleware\ThrottleMiddleware', + 'throttle' => 'Illuminate\Routing\Middleware\ThrottleRequests', ]; } diff --git a/app/Http/Routes/AuthRoutes.php b/app/Http/Routes/AuthRoutes.php index 776c2574..b9b6725e 100644 --- a/app/Http/Routes/AuthRoutes.php +++ b/app/Http/Routes/AuthRoutes.php @@ -37,7 +37,7 @@ class AuthRoutes ]); $router->post('login', [ - 'middleware' => ['guest', 'throttling:10,10'], + 'middleware' => ['guest', 'throttle:10,10'], 'uses' => 'AuthController@postLogin', ]); @@ -47,7 +47,7 @@ class AuthRoutes ]); $router->post('2fa', [ - 'middleware' => ['throttling:10,10'], + 'middleware' => ['throttle:10,10'], 'uses' => 'AuthController@postTwoFactor', ]); diff --git a/composer.json b/composer.json index 7bbf0aa0..b4eb1319 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,6 @@ "graham-campbell/binput": "^3.3", "graham-campbell/core": "^4.2", "graham-campbell/markdown": "^6.0", - "graham-campbell/throttle": "^5.1", "graham-campbell/exceptions": "^8.3", "guzzlehttp/guzzle": "^6.1", "jenssegers/date": "^3.1", diff --git a/composer.lock b/composer.lock index ea36fbbc..9a3833f7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4679aa1d77fd3d0e6a4edcc6b72b2e31", - "content-hash": "be811d8ee1ae07b63536110056584327", + "hash": "4c9b02be73cb5a201981e8fb59e1c12b", + "content-hash": "8ad3d1b6eec470748458409d2fc149b7", "packages": [ { "name": "alt-three/badger", @@ -1328,67 +1328,6 @@ ], "time": "2016-01-30 14:22:10" }, - { - "name": "graham-campbell/throttle", - "version": "v5.1.1", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Laravel-Throttle.git", - "reference": "10e1690424f0df5e98e6e8f7a27429b0d99507b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Laravel-Throttle/zipball/10e1690424f0df5e98e6e8f7a27429b0d99507b4", - "reference": "10e1690424f0df5e98e6e8f7a27429b0d99507b4", - "shasum": "" - }, - "require": { - "illuminate/cache": "5.1.*|5.2.*", - "illuminate/contracts": "5.1.*|5.2.*", - "illuminate/http": "5.1.*|5.2.*", - "illuminate/support": "5.1.*|5.2.*", - "php": ">=5.5.9" - }, - "require-dev": { - "graham-campbell/testbench": "^3.1", - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.8|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "psr-4": { - "GrahamCampbell\\Throttle\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "graham@alt-three.com" - } - ], - "description": "Throttle Is A Rate Limiter For Laravel 5", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Laravel Throttle", - "Laravel-Throttle", - "framework", - "laravel", - "rate limit", - "throttle", - "throttling" - ], - "time": "2016-01-30 14:21:35" - }, { "name": "guzzlehttp/guzzle", "version": "6.1.1", diff --git a/config/app.php b/config/app.php index 44148c67..460f1977 100644 --- a/config/app.php +++ b/config/app.php @@ -169,7 +169,6 @@ return [ 'GrahamCampbell\Core\CoreServiceProvider', 'GrahamCampbell\Markdown\MarkdownServiceProvider', 'GrahamCampbell\Security\SecurityServiceProvider', - 'GrahamCampbell\Throttle\ThrottleServiceProvider', 'Jenssegers\Date\DateServiceProvider', 'McCool\LaravelAutoPresenter\AutoPresenterServiceProvider', 'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider', diff --git a/config/throttle.php b/config/throttle.php deleted file mode 100644 index 75bdde6f..00000000 --- a/config/throttle.php +++ /dev/null @@ -1,30 +0,0 @@ - null, - -];