mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-20 17:46:03 +02:00
Initial upload of the control panel
This commit is contained in:
parent
f21bd93fbc
commit
7eab26586c
791 changed files with 312718 additions and 0 deletions
29
cp/app/Middleware/CsrfViewMiddleware.php
Normal file
29
cp/app/Middleware/CsrfViewMiddleware.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
|
||||
|
||||
/**
|
||||
* CsrfViewMiddleware
|
||||
*
|
||||
* @author Hezekiah O. <support@hezecom.com>
|
||||
*/
|
||||
class CsrfViewMiddleware extends Middleware
|
||||
{
|
||||
|
||||
public function __invoke(Request $request, RequestHandler $handler)
|
||||
{
|
||||
$this->container->get('view')->getEnvironment()->addGlobal('csrf', [
|
||||
'field' => '
|
||||
<input type="hidden" name="'. $this->container->get('csrf')->getTokenNameKey() .'"
|
||||
value="'. $this->container->get('csrf')->getTokenName() .'">
|
||||
<input type="hidden" name="'. $this->container->get('csrf')->getTokenValueKey() .'"
|
||||
value="'. $this->container->get('csrf')->getTokenValue() .'">
|
||||
',
|
||||
]);
|
||||
$response = $handler->handle($request);
|
||||
return $response;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue