From e50d80560cb91a087401f9b02a693069e36921d3 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Wed, 20 Mar 2024 20:43:53 -0300 Subject: [PATCH] FIX: Auth missing from some routes --- app/setup/middlewares/01_auth.php | 2 +- app/src/Middleware/Authentication.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/setup/middlewares/01_auth.php b/app/setup/middlewares/01_auth.php index 55d016a..8f51dbe 100644 --- a/app/setup/middlewares/01_auth.php +++ b/app/setup/middlewares/01_auth.php @@ -1,2 +1,2 @@ add($app->getContainer()->get(Incoviba\Middleware\Authentication::class)); +$app->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class)); diff --git a/app/src/Middleware/Authentication.php b/app/src/Middleware/Authentication.php index ca1a79b..6e5e6a7 100644 --- a/app/src/Middleware/Authentication.php +++ b/app/src/Middleware/Authentication.php @@ -46,10 +46,16 @@ class Authentication $valid_paths = [ '/', + '/api' ]; if (in_array($current_path, $valid_paths, true)) { return true; } + foreach ($valid_paths as $path) { + if (str_starts_with($current_path, $path)) { + return true; + } + } $valid_uris = [ $this->login_url, ];