From a903153fe2ae43ca7f8d9530d1ec0457ae2832d8 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Wed, 1 Jul 2026 13:29:51 -0400 Subject: [PATCH] - Fix conflicts --- meta/definitions/authorize.php | 6 ++++++ skeleton/meta/definitions/auth.php | 2 +- src/ControllerTrait.php | 7 +++++++ src/Factory/HttpFactory.php | 4 ++-- src/Lean.php | 11 +++++++++++ src/Response/FileDownloadResponse.php | 1 - view/lean/block/message.phtml | 11 +++++++++++ view/lean/widget/message.phtml | 12 +----------- 8 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 view/lean/block/message.phtml diff --git a/meta/definitions/authorize.php b/meta/definitions/authorize.php index 359a515..33b3f5f 100644 --- a/meta/definitions/authorize.php +++ b/meta/definitions/authorize.php @@ -10,6 +10,8 @@ use Ulmus\User\{Authorize\HeaderAuthentication, Middleware\AuthenticationMiddleware, Middleware\HeaderAuthenticationMiddleware, Middleware\PostRequestAuthenticationMiddleware, + Middleware\LocalMacAddressMiddleware, + Authorize\MacAddressAuthentication, Authorize\PostRequestAuthentication}; use Picea\Picea; @@ -34,6 +36,10 @@ return [ PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(PostRequestAuthentication::class)), + MacAddressAuthentication::class => create(MacAddressAuthentication::class)->constructor(get(Authenticate::class), "mac"), + + LocalMacAddressMiddleware::class => create(LocalMacAddressMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(MacAddressAuthentication::class)), + 'authentication.method' => null, 'authorize.error' => function(ContainerInterface $c) { diff --git a/skeleton/meta/definitions/auth.php b/skeleton/meta/definitions/auth.php index 0a91ed4..53b7c74 100644 --- a/skeleton/meta/definitions/auth.php +++ b/skeleton/meta/definitions/auth.php @@ -43,7 +43,7 @@ return [ EmailConfiguration::class => function($c) { $email = new EmailConfiguration( EmailConfiguration::AUTH_TYPE_SMTP ); - $email->smtpHost = getenv('SMTP_HOSTNAME'); + $email->smtpHost = getenv('SMTP_HOST'); $email->smtpPort = getenv('SMTP_PORT'); $email->smtpUsername = getenv('SMTP_USERNAME'); $email->smtpPassword = getenv('SMTP_PASSWORD'); diff --git a/src/ControllerTrait.php b/src/ControllerTrait.php index 28b4b40..31dcbc0 100644 --- a/src/ControllerTrait.php +++ b/src/ControllerTrait.php @@ -82,6 +82,13 @@ trait ControllerTrait { return HttpFactory::createRedirectResponse($url, $code, $headers); } + #[Ignore] + protected function refresh(int $code = 204, array $headers = []) { + return static::renderNothing($code, [ + 'Refresh' => 0 + ] + $headers); + } + #[Ignore] public static function renderNothing(int $code = 204, array $headers = []) : ResponseInterface { diff --git a/src/Factory/HttpFactory.php b/src/Factory/HttpFactory.php index 390bf4f..ed48175 100644 --- a/src/Factory/HttpFactory.php +++ b/src/Factory/HttpFactory.php @@ -11,9 +11,9 @@ use Psr\Http\Message\StreamInterface; class HttpFactory implements HttpFactoryInterface { - public static function createResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface + public static function createResponse(mixed $body = 'php://memory', int $code = 200, array $headers = []) : ResponseInterface { - return new Response($url, $code, $headers); + return new Response($body, $code, $headers); } public static function createRedirectResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface diff --git a/src/Lean.php b/src/Lean.php index 32fc06b..bd48417 100644 --- a/src/Lean.php +++ b/src/Lean.php @@ -244,4 +244,15 @@ class Lean return call_user_func($func); } + + public static function path(...$parts) : string + { + return implode(DIRECTORY_SEPARATOR, $parts); + } + + + public static function rawPath(...$parts) : string + { + return implode(DIRECTORY_SEPARATOR, $parts); + } } diff --git a/src/Response/FileDownloadResponse.php b/src/Response/FileDownloadResponse.php index 9bcce2a..cdf5e97 100644 --- a/src/Response/FileDownloadResponse.php +++ b/src/Response/FileDownloadResponse.php @@ -43,7 +43,6 @@ class FileDownloadResponse extends Response else { $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, $filepath); - finfo_close($finfo); } parent::__construct( diff --git a/view/lean/block/message.phtml b/view/lean/block/message.phtml new file mode 100644 index 0000000..a969bf8 --- /dev/null +++ b/view/lean/block/message.phtml @@ -0,0 +1,11 @@ +{% arguments array $contextList %} + +{% if $contextList %} +
{% php + foreach($contextList as $name => $context) { + foreach($context->formContextMessages ?? [] as $message) { + echo $message->render(); + } + } + %}
+{% endif %} \ No newline at end of file diff --git a/view/lean/widget/message.phtml b/view/lean/widget/message.phtml index 0969f4a..4d5412b 100644 --- a/view/lean/widget/message.phtml +++ b/view/lean/widget/message.phtml @@ -5,14 +5,4 @@ if ($context && ! in_array($context, $messageList)) { $messageList[] = $context; } -%} - -{% if $messageList %} -
{% php - foreach($messageList as $name => $context) { - foreach($context->formContextMessages ?? [] as $message) { - echo $message->render(); - } - } - %}
-{% endif %} \ No newline at end of file +%}{% block "lean/block/message", $messageList %}{% endblock %} \ No newline at end of file