increase browser requirement
This commit is contained in:
parent
60c628dd11
commit
9f8f1e786a
@ -32,7 +32,7 @@ class Kernel extends HttpKernel
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class,
|
||||
\App\Http\Middleware\ForbiddenIE::class,
|
||||
\App\Http\Middleware\EnforceEverGreen::class,
|
||||
\App\Http\Middleware\RedirectToSetup::class,
|
||||
],
|
||||
|
||||
|
25
app/Http/Middleware/EnforceEverGreen.php
Normal file
25
app/Http/Middleware/EnforceEverGreen.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class EnforceEverGreen
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$userAgent = $request->userAgent();
|
||||
|
||||
preg_match('/Chrome\/(\d+)/', $userAgent, $matches);
|
||||
$isOldChrome = Arr::has($matches, 1) && $matches[1] < 55;
|
||||
|
||||
if ($isOldChrome || Str::contains($userAgent, ['Trident', 'MSIE'])) {
|
||||
throw new PrettyPageException(trans('errors.http.ie'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ForbiddenIE
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Str::contains($request->userAgent(), ['Trident', 'MSIE'])) {
|
||||
throw new PrettyPageException(trans('errors.http.ie'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ http:
|
||||
msg-503: The application is now in maintenance mode.
|
||||
method-not-allowed: Method not allowed.
|
||||
csrf-token-mismatch: Token does not match, try reloading the page.
|
||||
ie: We don't support Internet Explorer. Please switch to other modern browsers, such as Firefox or Chrome.
|
||||
ie: Your browser isn't supported. Please switch to other modern browsers, such as Firefox or Chrome.
|
||||
|
||||
general:
|
||||
title: Error occurred
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Tests;
|
||||
|
||||
class ForbiddenIETest extends TestCase
|
||||
class EnforceEverGreenTest extends TestCase
|
||||
{
|
||||
public function testHandle()
|
||||
{
|
||||
@ -10,5 +10,8 @@ class ForbiddenIETest extends TestCase
|
||||
->assertSee(trans('errors.http.ie'));
|
||||
$this->get('/', ['user-agent' => 'Trident'])
|
||||
->assertSee(trans('errors.http.ie'));
|
||||
$this->get('/', [
|
||||
'user-agent' => 'AppleWebKit/537.36 Chrome/54.0.2403.157 Safari/537.36',
|
||||
])->assertSee(trans('errors.http.ie'));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user