From b8b1e1ce617fb88cf4adc5d76dc9fb1924b3fc37 Mon Sep 17 00:00:00 2001 From: Thai Phan Date: Sun, 10 Jun 2018 15:27:51 +1000 Subject: [PATCH] Add support for CAPTCHA --- Model/Captcha/DefaultModel/Plugin.php | 32 +++++++++++++++++++++++++++ README.md | 1 + etc/di.xml | 3 +++ 3 files changed, 36 insertions(+) create mode 100644 Model/Captcha/DefaultModel/Plugin.php diff --git a/Model/Captcha/DefaultModel/Plugin.php b/Model/Captcha/DefaultModel/Plugin.php new file mode 100644 index 0000000..78de188 --- /dev/null +++ b/Model/Captcha/DefaultModel/Plugin.php @@ -0,0 +1,32 @@ +helper = $helper; + $this->database = $database; + } + + public function afterGenerate(\Magento\Captcha\Model\DefaultModel $subject, $result) + { + if ($this->helper->checkS3Usage()) { + $imgFile = $subject->getImgDir() . $result . $subject->getSuffix(); + $relativeImgFile = $this->database->getMediaRelativePath($imgFile); + $this->database->getStorageDatabaseModel()->saveFile($relativeImgFile); + } + + return $result; + } +} \ No newline at end of file diff --git a/README.md b/README.md index 2a5ace1..178e40a 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ The following images are automatically saved to S3: * Generated thumbnails * WYSIWYG images * Category images +* CAPTCHA images ### Magento can now scale horizontally diff --git a/etc/di.xml b/etc/di.xml index dd742ee..b0f741d 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -49,4 +49,7 @@ + + +