From 61081ac65cf340c79073e12c33e4062e6de1d96e Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sat, 15 Jun 2024 22:32:31 -0400 Subject: [PATCH] Add middleware conforming to the PSR interfaces --- .../Middleware/VerifyPasswordMiddleware.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/src/Middleware/VerifyPasswordMiddleware.php diff --git a/app/src/Middleware/VerifyPasswordMiddleware.php b/app/src/Middleware/VerifyPasswordMiddleware.php new file mode 100644 index 0000000..9e8db47 --- /dev/null +++ b/app/src/Middleware/VerifyPasswordMiddleware.php @@ -0,0 +1,33 @@ +getParsedBody(); + + if ($requestData['password'] !== $requestData['checked_password']) { + + $this->session + ->getFlash() + ->add('error', "Passwords do not match."); + $response = $handler->handle($request); + return $response->withStatus(400); + } + + return $handler->handle($request); + } +}