mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
ba9c06cb18
* bug fix * csrf filters * request API error handler implementation * add utils dependency * add response dependency
45 lines
906 B
PHP
45 lines
906 B
PHP
<?php namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
|
|
|
|
/**
|
|
* Class VerifyCsrfToken
|
|
*/
|
|
class VerifyCsrfToken extends BaseVerifier
|
|
{
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $openRoutes = [
|
|
'complete/*',
|
|
'signup/register',
|
|
'api/v1/*',
|
|
'hook/email_opened',
|
|
'hook/email_bounced',
|
|
'reseller_stats',
|
|
'payment_hook/*',
|
|
'buy_now/*',
|
|
'hook/bot/*',
|
|
];
|
|
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param Request $request
|
|
* @param Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
foreach ($this->openRoutes as $route) {
|
|
if ($request->is($route)) {
|
|
return $next($request);
|
|
}
|
|
}
|
|
|
|
return parent::handle($request, $next);
|
|
}
|
|
}
|