From ae8b73cb88fecd4afb470c14270794a5bab117f4 Mon Sep 17 00:00:00 2001 From: Erik Thuning <boooink@gmail.com> Date: Wed, 27 Jul 2022 13:15:06 +0200 Subject: [PATCH] Trim whitespace from serials when checking out and returning products --- include/Ajax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Ajax.php b/include/Ajax.php index 1fa756d..99abc22 100644 --- a/include/Ajax.php +++ b/include/Ajax.php @@ -87,7 +87,7 @@ class Ajax extends Responder { } $product = null; try { - $product = new Product($_POST['product'], 'serial'); + $product = new Product(trim($_POST['product']), 'serial'); } catch(Exception $e) { return new Failure('Ogiltigt serienummer.'); } @@ -102,7 +102,7 @@ class Ajax extends Responder { private function return_product() { $product = null; try { - $product = new Product($_POST['serial'], 'serial'); + $product = new Product(trim($_POST['serial']), 'serial'); } catch(Exception $e) { return new Failure('Ogiltigt serienummer.'); }