2018-10-04 19:10:43 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2019-05-11 05:32:07 +02:00
|
|
|
*/
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
2022-01-15 05:07:40 +01:00
|
|
|
use Illuminate\Session\TokenMismatchException;
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
class VerifyCsrfToken extends Middleware
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
protected $addHttpCookie = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URIs that should be excluded from CSRF verification.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $except = [
|
2021-06-02 10:55:33 +02:00
|
|
|
// 'livewire/message/*'
|
2018-10-04 19:10:43 +02:00
|
|
|
];
|
2022-01-15 05:07:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
public function handle($request, \Closure $next) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
return parent::handle($request, $next);
|
|
|
|
} catch (TokenMismatchException $ex) {
|
|
|
|
|
|
|
|
throw new TokenMismatchException('CSRF token mismatch.');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-04 19:10:43 +02:00
|
|
|
}
|