Browse Source

add captcha verification to cv-pdf download

olinox14 1 year ago
parent
commit
3f9d9d994e
1 changed files with 13 additions and 13 deletions
  1. 13 13
      src/State/Processor/CvPdfRequestProcessor.php

+ 13 - 13
src/State/Processor/CvPdfRequestProcessor.php

@@ -29,19 +29,19 @@ class CvPdfRequestProcessor implements ProcessorInterface
         /** @var CvPdfRequest $cvPdfRequest */
         $cvPdfRequest = $data;
 
-//        try {
-//            $valid = Altcha::verifySolution(
-//                $cvPdfRequest->getAltchaPayload(),
-//                $this->hmacKey,
-//                true
-//            );
-//        } catch (\Throwable) {
-//            $valid = false;
-//        }
-//
-//        if (!$valid) {
-//            throw new \RuntimeException('Invalid payload');
-//        }
+        try {
+            $valid = Altcha::verifySolution(
+                $cvPdfRequest->getAltchaPayload(),
+                $this->hmacKey,
+                true
+            );
+        } catch (\Throwable) {
+            $valid = false;
+        }
+
+        if (!$valid) {
+            throw new \RuntimeException('Invalid payload');
+        }
 
         $content = (new Path($this->projectDir))
             ->append('static', 'CV_Olivier_Massot.pdf')