Browse Source

switch api to prod mode

olinox14 1 year ago
parent
commit
fa11c23053
2 changed files with 10 additions and 6 deletions
  1. 1 1
      .env
  2. 9 5
      src/State/Processor/ContactRequestProcessor.php

+ 1 - 1
.env

@@ -1,5 +1,5 @@
 ###> symfony/framework-bundle ###
-APP_ENV=dev
+APP_ENV=prod
 APP_SECRET=8404413e47480859f70c6a7e1acfa2d5
 ###< symfony/framework-bundle ###
 

+ 9 - 5
src/State/Processor/ContactRequestProcessor.php

@@ -35,11 +35,15 @@ class ContactRequestProcessor implements ProcessorInterface
         /** @var ContactRequest $contactRequest */
         $contactRequest = $data;
 
-        $valid = Altcha::verifySolution(
-            $contactRequest->getAltchaPayload(),
-            $this->hmacKey,
-            true
-        );
+        try {
+            $valid = Altcha::verifySolution(
+                $contactRequest->getAltchaPayload(),
+                $this->hmacKey,
+                true
+            );
+        } catch (\Throwable) {
+            $valid = false;
+        }
 
         if (!$valid) {
             throw new \RuntimeException('Invalid payload');