1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Http/Middleware/VerifyCsrfToken.php

36 lines
730 B
PHP
Raw Normal View History

2015-03-12 01:44:39 +01:00
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier {
2015-04-08 20:19:58 +02:00
private $openRoutes = [
'api/v1/clients',
'api/v1/invoices',
'api/v1/quotes',
'api/v1/payments',
'api/v1/email_invoice',
];
2015-03-12 01:44:39 +01:00
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
2015-04-08 20:19:58 +02:00
foreach($this->openRoutes as $route) {
if ($request->is($route)) {
return $next($request);
}
}
2015-03-12 01:44:39 +01:00
return parent::handle($request, $next);
}
}