38 lines
952 B
PHP
38 lines
952 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\Customer\Plugin\Captcha;
|
|
|
|
use Magento\Captcha\Helper\Data;
|
|
use Magento\Captcha\Model\CaptchaInterface;
|
|
use Magento\Captcha\Model\DefaultModel;
|
|
|
|
class ImproveForgotPasswordCaptchaPlugin
|
|
{
|
|
private const FORM_ID = 'user_forgotpassword';
|
|
|
|
/**
|
|
* Improve readability only for the storefront forgot-password CAPTCHA.
|
|
*
|
|
* @param Data $subject
|
|
* @param CaptchaInterface $captcha
|
|
* @param mixed $formId
|
|
* @return CaptchaInterface
|
|
*/
|
|
public function afterGetCaptcha(
|
|
Data $subject,
|
|
CaptchaInterface $captcha,
|
|
$formId
|
|
): CaptchaInterface {
|
|
if ($formId === self::FORM_ID && $captcha instanceof DefaultModel) {
|
|
$captcha->setWidth(240)
|
|
->setHeight(64)
|
|
->setFontSize(26)
|
|
->setDotNoiseLevel(12)
|
|
->setLineNoiseLevel(0);
|
|
}
|
|
|
|
return $captcha;
|
|
}
|
|
}
|