2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
2015-03-12 01:44:39 +01:00
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
|
|
|
|
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
2017-01-30 20:40:43 +01:00
|
|
|
* Class VerifyCsrfToken.
|
2016-07-03 18:11:58 +02:00
|
|
|
*/
|
|
|
|
class VerifyCsrfToken extends BaseVerifier
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
2015-04-08 20:19:58 +02:00
|
|
|
private $openRoutes = [
|
2017-08-14 18:32:39 +02:00
|
|
|
'complete*',
|
2015-05-10 21:02:35 +02:00
|
|
|
'signup/register',
|
2016-01-29 02:47:35 +01:00
|
|
|
'api/v1/*',
|
2015-10-11 16:41:09 +02:00
|
|
|
'hook/email_opened',
|
|
|
|
'hook/email_bounced',
|
2016-01-28 13:04:55 +01:00
|
|
|
'reseller_stats',
|
2016-07-03 18:11:58 +02:00
|
|
|
'payment_hook/*',
|
2017-05-09 12:18:03 +02:00
|
|
|
'buy_now*',
|
2016-08-14 11:30:16 +02:00
|
|
|
'hook/bot/*',
|
2015-04-08 20:19:58 +02:00
|
|
|
];
|
|
|
|
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
2017-01-30 20:40:43 +01:00
|
|
|
* @param Request $request
|
|
|
|
* @param Closure $next
|
|
|
|
*
|
2016-07-03 18:11:58 +02:00
|
|
|
* @return mixed
|
|
|
|
*/
|
2016-07-04 09:00:00 +02:00
|
|
|
public function handle($request, Closure $next)
|
2016-07-03 18:11:58 +02:00
|
|
|
{
|
|
|
|
foreach ($this->openRoutes as $route) {
|
|
|
|
if ($request->is($route)) {
|
|
|
|
return $next($request);
|
|
|
|
}
|
2015-04-08 20:19:58 +02:00
|
|
|
}
|
|
|
|
|
2016-07-03 18:11:58 +02:00
|
|
|
return parent::handle($request, $next);
|
|
|
|
}
|
2015-03-12 01:44:39 +01:00
|
|
|
}
|