Merge fixes into v5.5 branch (#12)
--------- Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
This commit is contained in:
		
					parent
					
						
							
								f59b8d46c6
							
						
					
				
			
			
				commit
				
					
						ad01e15e5a
					
				
			
		
					 18 changed files with 59 additions and 408 deletions
				
			
		| 
						 | 
				
			
			@ -11,7 +11,5 @@ class PreventRequestsDuringMaintenance extends Middleware
 | 
			
		|||
     *
 | 
			
		||||
     * @var array<int, string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $except = [
 | 
			
		||||
        //
 | 
			
		||||
    ];
 | 
			
		||||
    protected $except = [];
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,5 +26,5 @@ public function handle(Request $request, Closure $next, string ...$guards): Resp
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        return $next($request);
 | 
			
		||||
    }
 | 
			
		||||
    } // End handle().
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,5 @@ class VerifyCsrfToken extends Middleware
 | 
			
		|||
     *
 | 
			
		||||
     * @var array<int, string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $except = [
 | 
			
		||||
        //
 | 
			
		||||
    ];
 | 
			
		||||
    protected $except = [];
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue