More fixes

This commit is contained in:
Frankie B 2023-07-29 17:42:19 +01:00
parent d781702215
commit 667da58bd9
No known key found for this signature in database
6 changed files with 9 additions and 13 deletions

View file

@ -11,7 +11,5 @@ class PreventRequestsDuringMaintenance extends Middleware
*
* @var array<int, string>
*/
protected $except = [
//
];
protected $except = [];
}

View file

@ -17,14 +17,14 @@ class RateLimiter
public function handle(Request $request, Closure $next): Response
{
$ipAddress = $request->ip();
$cacheKey = 'rate_limit_' . $ipAddress;
$cacheKey = 'rate_limit_'.$ipAddress;
if (Cache::has($cacheKey)) {
// If the cache key exists, the IP has submitted an entry within the last hour
// If the cache key exists, the IP has submitted an entry within the last hour.
return response()->view('errors.guestbook-ratelimit', [], 429);
}
// Add the IP address to the cache and set the expiration time to one hour
// Add the IP address to the cache and set the expiration time to one hour.
Cache::put($cacheKey, true, 3600);
return $next($request);

View file

@ -26,5 +26,5 @@ public function handle(Request $request, Closure $next, string ...$guards): Resp
}
return $next($request);
}
} // end handle()
}

View file

@ -19,10 +19,11 @@ class TrustProxies extends Middleware
*
* @var int
*/
protected $headers =
protected $headers =(
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
Request::HEADER_X_FORWARDED_AWS_ELB
);
}

View file

@ -11,7 +11,5 @@ class VerifyCsrfToken extends Middleware
*
* @var array<int, string>
*/
protected $except = [
//
];
protected $except = [];
}

View file

@ -2,7 +2,6 @@
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider