1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 00:53:10 +01:00
invoiceninja/app/Http/Middleware/PhantomSecret.php

35 lines
810 B
PHP
Raw Normal View History

2020-08-04 13:00:19 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
2020-08-04 13:00:19 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
2020-08-04 13:00:19 +02:00
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Middleware;
use Closure;
2020-10-28 11:10:49 +01:00
use Illuminate\Http\Request;
2020-08-04 13:00:19 +02:00
class PhantomSecret
{
/**
* Handle an incoming request.
*
2020-10-28 11:10:49 +01:00
* @param Request $request
* @param Closure $next
2020-08-04 13:00:19 +02:00
* @return mixed
*/
public function handle($request, Closure $next)
{
if (config('ninja.phantomjs_secret') && $request->has('phantomjs_secret') && (config('ninja.phantomjs_secret') == $request->input('phantomjs_secret'))) {
2020-08-04 13:00:19 +02:00
return $next($request);
}
return redirect('/');
2020-08-04 13:00:19 +02:00
}
}