From fccd92154556f485e9cf4f1c0150b2e7b8967f42 Mon Sep 17 00:00:00 2001 From: Christiaan Goossens Date: Sun, 2 Apr 2017 12:04:22 +0200 Subject: [PATCH] Server fixes --- src/Application/Auth/Middleware.php | 8 +++++++- src/Application/Idob.php | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Application/Auth/Middleware.php b/src/Application/Auth/Middleware.php index f9b8ec5..a5bfffd 100644 --- a/src/Application/Auth/Middleware.php +++ b/src/Application/Auth/Middleware.php @@ -23,7 +23,13 @@ class Middleware { $container = Application::getContainer(); $uri = $request->getUri(); + $path = $uri->getPath(); + + if (substr($path, 0, 1) != '/') { + $path = "/".$path; + } + $query = $uri->getQuery(); // Check for an existing session @@ -33,7 +39,7 @@ class Middleware // Redirect to the login page if ($query !== "") { return Redirect::create($request, $response, '/login?redirect='.$path."&".$query); - } elseif ($path = "/") { + } elseif ($path === "/") { return Redirect::create($request, $response, '/login'); } else { return Redirect::create($request, $response, '/login?redirect='.$path); diff --git a/src/Application/Idob.php b/src/Application/Idob.php index 16e30b9..1c9ddc8 100644 --- a/src/Application/Idob.php +++ b/src/Application/Idob.php @@ -19,8 +19,8 @@ use Inforbank\Application\Auth\Middleware; use Inforbank\Application\Helper\Header; use Inforbank\Application\Helper\Idob\Transactie; use Inforbank\Application\Helper\Idob\Client; -use Inforbank\Application\Helper\Rekeningen; -use Inforbank\Application\Helper\Berichten; +use Inforbank\Application\Helper\Rekeningen as RekeningHelper; +use Inforbank\Application\Helper\Berichten as BerichtenHelper; use Inforbank\Application\Helper\Overboekingen; use Inforbank\Application\Helper\Redirect; use Inforbank\Application\Helper\IBAN; @@ -35,7 +35,7 @@ class Idob $app->group('/idob', function () { $this->get('/betalen', function ($request, $response, $args) { $query = $request->getQueryParams(); - $rekeningen = Rekeningen::getCurrentUserRekeningen(); + $rekeningen = RekeningHelper::getCurrentUserRekeningen(); try { $transactie = Transactie::getTransactie($query['trxid']); @@ -84,7 +84,7 @@ class Idob Transactie::setTransactionStatus($transactie['transactieId'], 2); // Do bericht - Berichten::newBericht($this->auth->getUserID(), $naam, "Betaling met transactiereferentie " . $transactie['reference'] . " gelukt."); + BerichtenHelper::newBericht($this->auth->getUserID(), $naam, "Betaling met transactiereferentie " . $transactie['reference'] . " gelukt."); $response = $response->withStatus(302); $response = $response->withHeader('Location', $redirectUri . "?trxid=".$transactie['transactieId']);