Compare commits
No commits in common. "01d48463b318d2174f8391e30b7f8da62e49717a" and "fda052d2f369cd7bba9110a604601290e09c7b9f" have entirely different histories.
01d48463b3
...
fda052d2f3
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
use Lean\Factory\HttpFactoryInterface;
|
use Lean\Factory\HttpFactoryInterface;
|
||||||
|
|
||||||
use Ulmus\User\{Authorize\HeaderAuthentication,
|
use Ulmus\User\{
|
||||||
|
Authorize\HeaderAuthentication, Authorize\PostRequestAuthentication,
|
||||||
Entity,
|
Entity,
|
||||||
Lib\Authenticate,
|
Lib\Authenticate, Lib\Authorize,
|
||||||
Lib\Authorize,
|
Middleware\AuthenticationMiddleware, Middleware\HeaderAuthenticationMiddleware, Middleware\PostRequestAuthenticationMiddleware,
|
||||||
Middleware\AuthenticationMiddleware,
|
};
|
||||||
Middleware\HeaderAuthenticationMiddleware,
|
|
||||||
Middleware\PostRequestAuthenticationMiddleware,
|
|
||||||
Authorize\PostRequestAuthentication};
|
|
||||||
|
|
||||||
use Picea\Picea;
|
use Picea\Picea;
|
||||||
use Storage\{ Cookie, Session };
|
use Storage\{ Cookie, Session };
|
||||||
@ -17,7 +15,6 @@ use Psr\Container\ContainerInterface;
|
|||||||
|
|
||||||
use function DI\{get, autowire, create};
|
use function DI\{get, autowire, create};
|
||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
||||||
|
|
||||||
@ -38,9 +35,9 @@ return [
|
|||||||
'authorize.error' => function(ContainerInterface $c) {
|
'authorize.error' => function(ContainerInterface $c) {
|
||||||
return function(array $errorData) use ($c) {
|
return function(array $errorData) use ($c) {
|
||||||
return $c->get(HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
return $c->get(HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||||
'api.error' => "Authorization failed",
|
'api.error' => "Authorization failed",
|
||||||
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
||||||
], 403);
|
], 403);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
|
||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
|
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
|
||||||
use Lean\Factory\{ HttpFactory, HttpFactoryInterface };
|
use Lean\Factory\{ HttpFactory, HttpFactoryInterface };
|
||||||
use Picea\Picea;
|
use Picea\Picea;
|
||||||
|
|
||||||
use function DI\{ autowire, create, get };
|
use function DI\autowire, DI\create, DI\get;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
ServerRequestInterface::class => function ($c) {
|
ServerRequestInterface::class => function ($c) {
|
||||||
@ -18,10 +20,6 @@ return [
|
|||||||
|
|
||||||
EmitterInterface::class => create(SapiEmitter::class),
|
EmitterInterface::class => create(SapiEmitter::class),
|
||||||
|
|
||||||
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
|
|
||||||
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
|
|
||||||
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
|
|
||||||
|
|
||||||
HttpFactoryInterface::class => create(HttpFactory::class),
|
HttpFactoryInterface::class => create(HttpFactory::class),
|
||||||
|
|
||||||
'error.401' => function(ContainerInterface $c, Picea $picea) {
|
'error.401' => function(ContainerInterface $c, Picea $picea) {
|
||||||
@ -34,5 +32,9 @@ return [
|
|||||||
|
|
||||||
'error.500' => function(ContainerInterface $c, Picea $picea) {
|
'error.500' => function(ContainerInterface $c, Picea $picea) {
|
||||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/500", []), 500);
|
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/500", []), 500);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
|
||||||
|
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
|
||||||
|
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
|
||||||
];
|
];
|
||||||
|
|||||||
@ -39,37 +39,4 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
|||||||
{
|
{
|
||||||
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
|
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
<<<<<<< HEAD
|
|
||||||
public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface
|
|
||||||
{
|
|
||||||
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
|
|
||||||
=======
|
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
|
||||||
{
|
|
||||||
if (php_sapi_name() !== 'cli' and ! defined('STDIN')) {
|
|
||||||
return $this->throw404($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $handler->handle($request);;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
|
||||||
{
|
|
||||||
if ( getenv('DEBUG') && $this->di->has(\Picea\Asset\Asset::class) ) {
|
|
||||||
$params = $request->getServerParams();
|
|
||||||
|
|
||||||
$scpName = basename(explode('?', $params['REQUEST_URI'] ?? "", 2)[0]);
|
|
||||||
list(, $ext) = array_pad(explode('.', $scpName), 2, null);
|
|
||||||
|
|
||||||
if ($ext && in_array($ext, ApplicationStrategy::ASSET_TRIGGER_UPDATE)) {
|
|
||||||
$this->di->get(\Picea\Asset\Asset::class)->launchInstall();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->di->get('error.404');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
>>>>>>> af8b686 (- WIP on ulmus-user mechanics updates)
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 42 KiB |
@ -10,7 +10,7 @@
|
|||||||
{% if $messageList %}
|
{% if $messageList %}
|
||||||
<div class="message-wrapper">{% php
|
<div class="message-wrapper">{% php
|
||||||
foreach($messageList as $name => $context) {
|
foreach($messageList as $name => $context) {
|
||||||
foreach($context->formContextMessages ?? [] as $message) {
|
foreach($context->messages ?? [] as $message) {
|
||||||
echo $message->render();
|
echo $message->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user