Prechádzať zdrojové kódy

Fix: category_name and product_name now allow symbols

EduLascala 4 mesiacov pred
rodič
commit
73f8589d3e

+ 1 - 1
controllers/CategoryCreateController.php

@@ -23,7 +23,7 @@ class CategoryCreateController
 
         try {
             v::key('company_id', v::intType()->positive())
-             ->key('category_name', v::stringType()->notEmpty()->alnum(' '))
+             ->key('category_name', v::stringType()->notEmpty()->regex('/^[\p{L}\p{N}\s\-\'\"]+$/u'))
              ->assert($body);
         } catch (ValidationException $e) {
             return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(401);

+ 1 - 1
controllers/DescriptionCreateController.php

@@ -17,7 +17,7 @@ class DescriptionCreateController
         try {
             v::key('product_id', v::intType()->positive())
              ->key('company_id', v::intType()->positive())
-             ->key('description_text', v::stringType()->notEmpty())
+             ->key('description_text', v::stringType()->notEmpty()->regex('/^[\p{L}\p{N}\s\-\'\"]+$/u'))
              ->assert($body);
         } catch (ValidationException $e) {
             return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(401);

+ 1 - 1
controllers/ProductCreateController.php

@@ -26,7 +26,7 @@ class ProductCreateController
 
         try {
             v::key('company_id', v::intType()->positive())
-            ->key('product_name', v::stringType()->notEmpty()->alnum(' '))
+            ->key('product_name', v::stringType()->notEmpty()->regex('/^[\p{L}\p{N}\s\-\'\"]+$/u'))
             ->key('product_price', v::number()->positive())
             ->key('category_id', v::intType()->positive())
             ->key('product_is_kitchen', v::optional(v::boolType()))