Explorar o código

fix ips and domain validations

Olivier Massot %!s(int64=5) %!d(string=hai) anos
pai
achega
4d9370b1c2

+ 5 - 1
ot_admin/Classes/Http/ApiController.php

@@ -17,7 +17,11 @@ class ApiController implements LoggerAwareInterface
     const ALLOWED_IPS = [
         '/^127\.0\.0\.[0-1]$/',
         '/^localhost$/',
-        '/^10\.8\.0\.\d{1,3}$/'
+        '/^10\.8\.0\.\d{1,3}$/',
+        '/^80\.245\.24\.68$/',   // prod-front
+        '/^80\.245\.24\.70$/',   // prod-back
+        '/^80\.245\.24\.72$/',   // test
+        '/^80\.245\.24\.74$/'    // preprod
     ];
 
     /**

+ 1 - 1
ot_stats/Classes/Domain/Repository/MatomoWebsiteRepository.php

@@ -22,7 +22,7 @@ class MatomoWebsiteRepository
      * Regex
      */
     const RELATIVE_PATH_VALIDATION = '/^\/[a-zA-Z0-9_\-]+\/?$/';
-    const DOMAIN_VALIDATION = '/^(https?:\/\/)?([a-zA-Z0-9]+\.)+[a-zA-Z]{2,}(:\d+)?(\/[a-zA-Z0-9_\-]+)*\/?$/';
+    const DOMAIN_VALIDATION = "/^(https?:\/\/)?([\w-]+\.)+[a-zA-Z]{2,}(:\d+)?(\/[a-zA-Z0-9_\-]+)*\/?$/";
 
     /**
      * Connection to the matomo DB