소스 검색

Fix: category_name and product_name now allow symbols

EduLascala 4 달 전
부모
커밋
73f8589d3e
3개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      controllers/CategoryCreateController.php
  2. 1 1
      controllers/DescriptionCreateController.php
  3. 1 1
      controllers/ProductCreateController.php

+ 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()))