Compare commits
2 Commits
master
...
ulmus-user
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c2ce07179 | ||
|
|
af8b686e3b |
@ -1,34 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Ulmus\User\{Entity,
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
|
||||
use Ulmus\User\{
|
||||
Authorize\HeaderAuthentication,
|
||||
Entity,
|
||||
Lib\Authenticate,
|
||||
Lib\Authorize,
|
||||
Middleware\AuthenticationMiddleware,
|
||||
Middleware\HeaderAuthenticationMiddleware,
|
||||
Middleware\PostRequestAuthenticationMiddleware,
|
||||
Authorize\PostRequestAuthentication};
|
||||
|
||||
use Picea\Picea;
|
||||
Authorize\PostRequestAuthentication
|
||||
};
|
||||
|
||||
use Storage\{ Cookie, Session };
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Picea\Picea;
|
||||
|
||||
use function DI\{get, create};
|
||||
use function DI\{get, autowire, create};
|
||||
|
||||
return [
|
||||
Authenticate::class => create(Authenticate::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')),
|
||||
|
||||
HeaderAuthenticationMiddleware::class => create(HeaderAuthenticationMiddleware::class)->constructor(get(Authorize::class), get(Entity\UserInterface::class), get('authorize.error')),
|
||||
Authenticate::class => create(Authenticate::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
||||
|
||||
PostRequestAuthentication::class => create(PostRequestAuthentication::class)->constructor(get(Authenticate::class), "email", "email", "password"),
|
||||
AuthenticationMiddleware::class => create(AuthenticationMiddleware::class)->constructor(get(Authorize::class), get('authorize.error')),
|
||||
|
||||
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(PostRequestAuthentication::class)),
|
||||
HeaderAuthentication::class => autowire(HeaderAuthentication::class),
|
||||
|
||||
HeaderAuthenticationMiddleware::class => create(HeaderAuthenticationMiddleware::class)->constructor(get(HeaderAuthentication::class)),
|
||||
|
||||
PostRequestAuthentication::class => create(PostRequestAuthentication::class)->constructor("email", "email", "password"),
|
||||
|
||||
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(PostRequestAuthentication::class)),
|
||||
|
||||
'authentication.method' => null,
|
||||
|
||||
'authorize.error' => function($c) {
|
||||
'authorize.error' => function(ContainerInterface $c) {
|
||||
return function(array $errorData) use ($c) {
|
||||
return $c->get(\Lean\Factory\HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||
return $c->get(HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||
|
||||
'api.error' => "Authorization failed",
|
||||
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
||||
], 403);
|
||||
@ -36,8 +47,8 @@ return [
|
||||
},
|
||||
|
||||
'authentication.error' => function($c, Picea $picea) {
|
||||
return function($message) use ($picea, $c) {
|
||||
return $c->get(\Lean\Factory\HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
return function($message) use ($c, $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
'title' => "Authentication failed",
|
||||
'subtitle' => "",
|
||||
'message' => $message,
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
|
||||
use function DI\autowire, DI\create, DI\get;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
|
||||
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator };
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
|
||||
use Lean\Factory\{ HttpFactory, HttpFactoryInterface };
|
||||
use Picea\Picea;
|
||||
|
||||
use function DI\autowire, DI\create, DI\get;
|
||||
|
||||
return [
|
||||
ServerRequestInterface::class => function ($c) {
|
||||
@ -15,7 +19,21 @@ return [
|
||||
},
|
||||
|
||||
EmitterInterface::class => create(SapiEmitter::class),
|
||||
|
||||
HttpFactoryInterface::class => create(HttpFactory::class),
|
||||
|
||||
'error.401' => function(ContainerInterface $c, Picea $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/401", []), 401);
|
||||
},
|
||||
|
||||
'error.404' => function(ContainerInterface $c, Picea $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/404", []), 404);
|
||||
},
|
||||
|
||||
'error.500' => function(ContainerInterface $c, Picea $picea) {
|
||||
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),
|
||||
];
|
||||
|
||||
@ -59,7 +59,7 @@ return [
|
||||
$router = $container->get(Router::class);
|
||||
|
||||
foreach([ 'routes.middlewares', 'app.middlewares' ] as $key) {
|
||||
if ($container->has($key)) {
|
||||
if ( $container->has($key) ) {
|
||||
foreach ($container->get($key) as $i => $middleware) {
|
||||
if ($container->has($middleware)) {
|
||||
$router->middleware($container->get($middleware));
|
||||
|
||||
@ -5,15 +5,6 @@
|
||||
"week": "week"
|
||||
},
|
||||
|
||||
"interval": {
|
||||
"years": "{$years} year(s)",
|
||||
"months": "{$months} month(s)",
|
||||
"days": "{$days} day(s)",
|
||||
"hours": "{$hours} hour(s)",
|
||||
"minutes": "{$minutes} minutes(s)",
|
||||
"seconds": "{$seconds} second(s)"
|
||||
},
|
||||
|
||||
"month": {
|
||||
"list": [
|
||||
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Décember"
|
||||
|
||||
@ -4,15 +4,6 @@
|
||||
"week": "semaine"
|
||||
},
|
||||
|
||||
"interval": {
|
||||
"years": "{$years} années(s)",
|
||||
"months": "{$months} mois",
|
||||
"days": "{$days} jour(s)",
|
||||
"hours": "{$hours} heure(s)",
|
||||
"minutes": "{$minutes} minutes(s)",
|
||||
"seconds": "{$seconds} seconde(s)"
|
||||
},
|
||||
|
||||
"month": {
|
||||
"list": [
|
||||
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
|
||||
|
||||
@ -8,27 +8,17 @@
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"php": "^8.4",
|
||||
"php": "^8.2",
|
||||
"ext-apcu": "*",
|
||||
"ext-sodium": "*",
|
||||
"ext-bcmath": "*",
|
||||
"ext-json": "*",
|
||||
"ext-readline": "*",
|
||||
"league/route": "^5.0.0-dev",
|
||||
"laminas/laminas-diactoros": "2.24.x-dev",
|
||||
"laminas/laminas-httphandlerrunner": "2.5.x-dev",
|
||||
"vlucas/phpdotenv": "^3.4@dev",
|
||||
"middlewares/whoops": "dev-master",
|
||||
"ralouphie/getallheaders": "3.x",
|
||||
"guzzlehttp/guzzle": "7.9.x-dev",
|
||||
"symfony/mailer": "6.3.x-dev",
|
||||
"league/oauth2-client": "dev-master",
|
||||
"php-di/php-di": "dev-master",
|
||||
"league/commonmark": "^2.7@dev",
|
||||
"assets-package/ace": "dev-master",
|
||||
"ralouphie/getallheaders": "dev-master",
|
||||
"mcnd/dump": "dev-master",
|
||||
"mcnd/storage": "dev-master",
|
||||
"mcnd/cli": "dev-master",
|
||||
"mcnd/event": "dev-master",
|
||||
"mcnd/ulmus": "dev-master",
|
||||
"mcnd/ulmus-api": "dev-master",
|
||||
@ -37,7 +27,6 @@
|
||||
"mcnd/picea-ui": "dev-master",
|
||||
"mcnd/picea-asset": "dev-master",
|
||||
"mcnd/cronard": "dev-master",
|
||||
"mcnd/lean-api": "dev-master",
|
||||
"mcnd/lean-console": "dev-master",
|
||||
"mcnd/kash": "dev-master",
|
||||
"mcnd/taxus": "dev-master",
|
||||
@ -50,10 +39,6 @@
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/cronard.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/cli.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/dump.git"
|
||||
@ -66,10 +51,6 @@
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/lean.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/lean-api.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/lean-console.git"
|
||||
@ -137,10 +118,6 @@
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/negundo-client.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/assets-package/ace.git"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
@ -159,7 +136,6 @@
|
||||
"extra" : {
|
||||
"lean" : {
|
||||
"autoload": {
|
||||
"order": 1000,
|
||||
"definitions" : [
|
||||
"meta/definitions/definitions.php",
|
||||
"meta/definitions/storage.php",
|
||||
|
||||
0
skeleton/cli → skeleton/lean
Executable file → Normal file
0
skeleton/cli → skeleton/lean
Executable file → Normal file
@ -4,6 +4,7 @@ use function DI\autowire, DI\create, DI\get;
|
||||
|
||||
use %NAMESPACE%\Entity;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
use Ulmus\Entity\Field\Datetime,
|
||||
@ -21,16 +22,18 @@ use TheBugs\Email\{ EmailConfiguration, MailerInterface, SwiftMailer };
|
||||
|
||||
use Taxus\{ Taxus, PermissionGrantInterface };
|
||||
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
|
||||
return [
|
||||
\Ulmus\User\Entity\UserInterface::class => autowire(Entity\User::class),
|
||||
|
||||
SecurityHandler::class => create(SecurityHandler::class)->constructor(function() {
|
||||
return Lean\Factory\HttpFactory::createRedirectResponse(getenv("URL_BASE")."/login");
|
||||
SecurityHandler::class => create(SecurityHandler::class)->constructor(function(ContainerInterface $c) {
|
||||
return $c->get(HttpFactoryInterface::class)::createRedirectResponse(getenv("URL_BASE")."/login");
|
||||
}, get('authentication.unauthorize'), get(Taxus::class)),
|
||||
|
||||
'authentication.unauthorize' => function($c, Picea $picea) {
|
||||
return function($message) use ($picea) {
|
||||
return Lean\Factory\HttpFactory::createHtmlResponse($picea->renderHtml('lean/error/401', [
|
||||
'authentication.unauthorize' => function(ContainerInterface $c, Picea $picea) {
|
||||
return function($message) use ($c, $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/401', [
|
||||
'title' => "",
|
||||
'subtitle' => "",
|
||||
'message' => $message,
|
||||
|
||||
@ -7,10 +7,6 @@ use function DI\{ autowire, add, create, get };
|
||||
$dir = dirname(__DIR__, 2);
|
||||
|
||||
return [
|
||||
\%NAMESPACE%\Factory\FormFactoryInterface::class => autowire(\%NAMESPACE%\Factory\FormFactory::class),
|
||||
\Lean\Api\Factory\MessageFactoryInterface::class => autowire(\%NAMESPACE%\Lib\Message::class),
|
||||
|
||||
|
||||
'%APPKEY%' => [
|
||||
'picea' => [
|
||||
'context' => "%ESCAPED_NAMESPACE%\\View",
|
||||
|
||||
8
skeleton/meta/definitions/env/prod.php
vendored
8
skeleton/meta/definitions/env/prod.php
vendored
@ -4,7 +4,7 @@ use Picea\Picea;
|
||||
|
||||
use Negundo\Client\{ NegundoMiddleware, SoftwareConfig };
|
||||
|
||||
use Lean\Factory\HttpFactory;
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
|
||||
use Psr\Http\Server\MiddlewareInterface,
|
||||
Psr\Http\Message\ServerRequestInterface,
|
||||
@ -31,11 +31,11 @@ return [
|
||||
|
||||
"errorHandler" => create(NegundoMiddleware::class)->constructor(get(SoftwareConfig::class), null, get('app.errorhandler.html')),
|
||||
|
||||
'app.errorhandler.html' => function($c, Picea $picea) {
|
||||
return function(\Throwable $exception) use ($picea) {
|
||||
'app.errorhandler.html' => function(\Psr\Container\ContainerInterface $c, Picea $picea) {
|
||||
return function(\Throwable $exception) use ($c, $picea) {
|
||||
error_log($exception->getMessage());
|
||||
|
||||
return HttpFactory::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
'title' => "Une erreur s'est produite lors de l'exécution du script.",
|
||||
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
|
||||
'message' => $exception->getMessage(),
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace %NAMESPACE%\Factory;
|
||||
|
||||
use Lean\Api\Factory\MessageFactoryInterface;
|
||||
use Lean\LanguageHandler;
|
||||
use Picea\Ui\Method\FormContextInterface;
|
||||
use Picea\Ui\Method\FormInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Storage\Session;
|
||||
use Ulmus\Entity\EntityInterface;
|
||||
use Ulmus\User\Entity\UserInterface;
|
||||
use Ulmus\User\Lib\Authenticate;
|
||||
|
||||
class FormFactory implements FormFactoryInterface
|
||||
{
|
||||
/*
|
||||
public function __construct(
|
||||
protected ServerRequestInterface $request,
|
||||
protected Authenticate $authenticate,
|
||||
protected Session $session,
|
||||
protected LanguageHandler $languageHandler,
|
||||
protected MessageFactoryInterface $messageFactory,
|
||||
) {}
|
||||
|
||||
public function save(EntityInterface $entity): FormInterface
|
||||
{
|
||||
return new Form\Save($this->languageHandler, $this->messageFactory, $entity);
|
||||
}
|
||||
|
||||
public function saveContext(? ServerRequestInterface $request = null, ? string $formName = null): FormContextInterface
|
||||
{
|
||||
return new Form\SaveContext($request ?: $this->request, $formName);
|
||||
}
|
||||
|
||||
public function delete(EntityInterface $entity): FormInterface
|
||||
{
|
||||
return new Form\Delete($this->languageHandler, $this->messageFactory, $entity);
|
||||
}
|
||||
|
||||
public function deleteContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface
|
||||
{
|
||||
return new Lib\FormContext($request, $formName);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace %NAMESPACE%\Factory;
|
||||
|
||||
use Lean\Api\Factory\MessageFactoryInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Picea\Ui\Method\{ FormInterface, FormContextInterface };
|
||||
use Storage\Session;
|
||||
use Lean\LanguageHandler;
|
||||
use Ulmus\Entity\EntityInterface;
|
||||
use Ulmus\User\Entity\UserInterface;
|
||||
use Ulmus\User\Lib\Authenticate;
|
||||
|
||||
interface FormFactoryInterface
|
||||
{
|
||||
/* public function __construct(ServerRequestInterface $request, Authenticate $authenticate, Session $session, LanguageHandler $languageHandler, MessageFactoryInterface $messageFactory,);
|
||||
|
||||
public function save(EntityInterface $entity): FormInterface;
|
||||
|
||||
public function saveContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface;
|
||||
|
||||
public function delete(EntityInterface $entity): FormInterface;
|
||||
|
||||
public function deleteContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface;*/
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace %NAMESPACE%\Lib;
|
||||
|
||||
use Picea\Picea;
|
||||
use Storage\Session;
|
||||
use Mcnd\Event\EventManager;
|
||||
use Notes\{ Attribute\Ignore, Route\Attribute\Object\Route, Security\Attribute\Security };
|
||||
use Ulmus\User\Entity\{ User, UserInterface };
|
||||
|
||||
use %NAMESPACE%\{ Entity, Lib, Form, Factory };
|
||||
|
||||
#[Security(locked: false)]
|
||||
#[Route(base: "/api", method: [ "GET", "POST", "PUT", "PATCH", "DELETE", ])]
|
||||
trait ApiTrait {
|
||||
use \Lean\ControllerTrait, \Lean\Api\LeanApiTrait {
|
||||
\Lean\Api\LeanApiTrait::renderMarkdown insteadof \Lean\ControllerTrait;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public UserInterface $user;
|
||||
|
||||
#[Ignore]
|
||||
protected EventManager $eventManager;
|
||||
|
||||
#[Ignore]
|
||||
protected Factory\FormFactoryInterface $formFactory;
|
||||
}
|
||||
@ -23,4 +23,19 @@ trait ControllerTrait {
|
||||
|
||||
#[Ignore]
|
||||
protected EventManager $eventManager;
|
||||
|
||||
#[Ignore]
|
||||
public function __construct(Picea $picea, Session $session, UserInterface $user, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
||||
$this->initializeController($picea, $session, $user, $breadcrumb, $eventManager);
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function initializeController(Picea $picea, Session $session, UserInterface $user, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
||||
$this->picea = $picea;
|
||||
$this->session = $session;
|
||||
$this->eventManager = $eventManager;
|
||||
$this->breadcrumb = $breadcrumb;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,10 +2,9 @@
|
||||
|
||||
namespace %NAMESPACE%\Lib;
|
||||
|
||||
use Lean\Api\Factory\MessageFactoryInterface;
|
||||
use Picea\Ui\Method\FormMessage;
|
||||
|
||||
class Message implements FormMessage, MessageFactoryInterface {
|
||||
class Message implements FormMessage {
|
||||
|
||||
const MESSAGE_TYPE = [
|
||||
'success' => [
|
||||
@ -35,7 +34,7 @@ class Message implements FormMessage, MessageFactoryInterface {
|
||||
|
||||
public ? string $header = null;
|
||||
|
||||
public function __construct(string $message = "", string $type = "error", ? string $header = null, ? string $class = null)
|
||||
public function __construct(string $message, string $type = "error", ? string $header = null, ? string $class = null)
|
||||
{
|
||||
$this->message = $message;
|
||||
|
||||
@ -87,33 +86,18 @@ class Message implements FormMessage, MessageFactoryInterface {
|
||||
return $this->type === "error";
|
||||
}
|
||||
|
||||
public static function generateSuccess(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||
public static function generateSuccess(string $message, ? string $header = null, ? string $class = null) : self
|
||||
{
|
||||
return new static($message, 'success', $header, $class);
|
||||
}
|
||||
|
||||
public static function generateError(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||
public static function generateError(string $message, ? string $header = null, ? string $class = null) : self
|
||||
{
|
||||
return new static($message, 'error', $header, $class);
|
||||
}
|
||||
|
||||
public static function generateWarning(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||
public static function generateWarning(string $message, ? string $header = null, ? string $class = null) : self
|
||||
{
|
||||
return new static($message, 'warning', $header, $class);
|
||||
}
|
||||
|
||||
public static function generateInformation(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||
{
|
||||
return new static($message, 'information', $header, $class);
|
||||
}
|
||||
|
||||
public static function generateDebug(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||
{
|
||||
return new static($message, 'debug', $header, $class);
|
||||
}
|
||||
|
||||
public static function generateTrace(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||
{
|
||||
return new static($message, 'trace', $header, $class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
namespace Lean;
|
||||
|
||||
use League\Route\Http\Exception\MethodNotAllowedException;
|
||||
use League\Route\Strategy;
|
||||
use League\Route\Http\Exception\NotFoundException;
|
||||
use Lean\ApplicationStrategy\MethodNotAllowedInterface;
|
||||
use Lean\ApplicationStrategy\NotFoundDecoratorInterface;
|
||||
use Lean\ApplicationStrategy\ThrowableHandlerInterface;
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
@ -32,10 +30,6 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
||||
public function getThrowableHandler(): MiddlewareInterface
|
||||
{
|
||||
return $this->getContainer()->get(ThrowableHandlerInterface::class);
|
||||
}
|
||||
|
||||
public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface
|
||||
{
|
||||
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Lean\ApplicationStrategy;
|
||||
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
|
||||
interface MethodNotAllowedInterface extends MiddlewareInterface
|
||||
{
|
||||
|
||||
}
|
||||
@ -102,7 +102,7 @@ class Composer
|
||||
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
||||
}
|
||||
|
||||
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true, 512, \JSON_THROW_ON_ERROR) : false;
|
||||
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
||||
}
|
||||
|
||||
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
||||
@ -125,7 +125,7 @@ class Composer
|
||||
|
||||
$event->getIO()->writeError("Your composer file do not seem to contains a valid psr-4 project pointing to the src folder.");
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static function createPath(... $path) : string
|
||||
|
||||
@ -8,7 +8,6 @@ use Notes\Attribute\Ignore;
|
||||
use Notes\Route\Attribute\Object\Route;
|
||||
use Notes\Security\Attribute\Security;
|
||||
use Picea, Picea\Ui\Method\FormContext;
|
||||
use Picea\Ui\Method\FormContextInterface;
|
||||
use TheBugs\Email\MailerInterface;
|
||||
use Storage\{ Cookie, Session };
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
@ -21,6 +20,9 @@ use function file_get_contents;
|
||||
#[Route(method: [ "GET", "POST" ])]
|
||||
trait ControllerTrait {
|
||||
|
||||
##[Inject]
|
||||
# public \Notes\Breadcrumb\Breadcrumb $breadcrumb;
|
||||
|
||||
#[Inject]
|
||||
public Session $session;
|
||||
|
||||
@ -210,7 +212,7 @@ trait ControllerTrait {
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function pushContext(FormContextInterface $context) : FormContextInterface
|
||||
public function pushContext(FormContext $context) : FormContext
|
||||
{
|
||||
$this->contextList[$context->formName ?? uniqid("context_")] = $context;
|
||||
|
||||
@ -218,7 +220,7 @@ trait ControllerTrait {
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function context(? string $name = null) : ? FormContextInterface
|
||||
public function context(? string $name = null) : ? FormContext
|
||||
{
|
||||
return $name ? $this->contextList[$name] : array_values($this->contextList)[0] ?? null;
|
||||
}
|
||||
|
||||
@ -5,9 +5,7 @@ namespace Lean\Factory;
|
||||
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
|
||||
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
|
||||
use Laminas\Diactoros\Response;
|
||||
use Laminas\Diactoros\StreamFactory;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
class HttpFactory implements HttpFactoryInterface
|
||||
{
|
||||
@ -60,9 +58,4 @@ class HttpFactory implements HttpFactoryInterface
|
||||
{
|
||||
return new FileDownloadResponse($path, $code, $headers);
|
||||
}
|
||||
|
||||
public static function createStream(string $content): StreamInterface
|
||||
{
|
||||
return (new StreamFactory())->createStream($content);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,11 +2,7 @@
|
||||
|
||||
namespace Lean\Factory;
|
||||
|
||||
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
|
||||
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
|
||||
use Laminas\Diactoros\Response;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
interface HttpFactoryInterface
|
||||
{
|
||||
@ -20,6 +16,4 @@ interface HttpFactoryInterface
|
||||
public static function createDownloadableResponse(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
public static function createImageResponse(string $data, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
public static function createFileDownloadResponse(string $path, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
|
||||
public static function createStream(string $content) : StreamInterface;
|
||||
}
|
||||
|
||||
@ -27,15 +27,18 @@ class Kernel {
|
||||
|
||||
public array $paths = [];
|
||||
|
||||
public int $errorReporting = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_NOTICE;
|
||||
public int $errorReporting = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE;
|
||||
|
||||
public array $definitionFilePaths;
|
||||
|
||||
public string $errorLogPath;
|
||||
|
||||
public function __construct(
|
||||
public string $projectPath
|
||||
) {
|
||||
public string $projectPath;
|
||||
|
||||
public function __construct(string $projectPath)
|
||||
{
|
||||
$this->projectPath = $projectPath;
|
||||
|
||||
$this->setEnvironment();
|
||||
$this->initializeEngine();
|
||||
$this->setupContainer();
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
{% arguments \DateInterval $interval %}
|
||||
|
||||
{% if $interval->y %}
|
||||
{% lang "lean.date.interval.years", [ 'years' => $interval->y ] %},
|
||||
{% endif %}
|
||||
|
||||
{% if $interval->m %}
|
||||
{% lang "lean.date.interval.months", [ 'months' => $interval->m ] %},
|
||||
{% endif %}
|
||||
|
||||
{% if $interval->d %}
|
||||
{% lang "lean.date.interval.days", [ 'days' => $interval->d ] %},
|
||||
{% endif %}
|
||||
|
||||
{% if $interval->h %}
|
||||
{% lang "lean.date.interval.hours", [ 'hours' => $interval->h ] %},
|
||||
{% endif %}
|
||||
|
||||
{% if $interval->i %}
|
||||
{% lang "lean.date.interval.minutes", [ 'minutes' => $interval->i ] %}
|
||||
{% else %}
|
||||
{% lang "lean.date.interval.seconds", [ 'seconds' => $interval->s ] %}
|
||||
{% endif %}
|
||||
@ -22,5 +22,5 @@
|
||||
{% section "head.css" %}
|
||||
.title {font-size:2rem}
|
||||
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
||||
.content {background: #f7f7f7;padding: 7px;color: #8c3c3c;max-height:300px;overflow-y:auto}
|
||||
.content {padding-top:1rem}
|
||||
{% endsection %}
|
||||
|
||||
@ -18,3 +18,9 @@
|
||||
{% view "lean/picto/undraw_lost" %}
|
||||
</div>
|
||||
{% endsection %}
|
||||
|
||||
{% section "head.css" %}
|
||||
.title {font-size:2rem}
|
||||
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
||||
.content {padding-top:1rem}
|
||||
{% endsection %}
|
||||
|
||||
@ -17,4 +17,10 @@
|
||||
<div class="picto-login">
|
||||
{% view "lean/picto/undraw_error" %}
|
||||
</div>
|
||||
{% endsection %}
|
||||
{% endsection %}
|
||||
|
||||
{% section "head.css" %}
|
||||
.title {font-size:2rem}
|
||||
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
||||
.content {background: #f7f7f7;padding: 7px;color: #8c3c3c;max-height:300px;overflow-y:auto}
|
||||
{% endsection %}
|
||||
|
||||
@ -10,14 +10,14 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
|
||||
|
||||
<style>
|
||||
body {background:#272822;min-height:100vh;}
|
||||
body {background:#272822}
|
||||
#main-content {min-height: 100vh;width: 100vw;align-items:center;justify-content: center;}
|
||||
#wrapper-content {max-width:960px; max-height:65vh;flex-direction:row-reverse; margin:0 10vw}
|
||||
#wrapper-content .content-right {background:#efefef;padding:5vh 2vw;align-items:center;display:flex;justify-content:center; width:100%;border-radius:6px 0 0 6px}
|
||||
#wrapper-content .content-left {background:#ffffff;padding:5vh 2vw;border-radius:0 6px 6px 0;display:flex;align-items:center;justify-content: center}
|
||||
|
||||
.form-user-login {width:80%;}
|
||||
.picto-login svg {max-width:100%;width:100%;max-height:33vh}
|
||||
.picto-login svg {max-width:100%;}
|
||||
|
||||
{% section "head.css" %}{% endsection %}
|
||||
</style>
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 40 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Loading…
x
Reference in New Issue
Block a user