shouldVerifyCaptcha example


    public function sNewsletterSubscription($email$unsubscribe = false, $groupID = null)
    {
        if (empty($unsubscribe)) {
            $errorFlag = [];
            $config = Shopware()->Container()->get(Shopware_Components_Config::class);

            if ($this->shouldVerifyCaptcha($config)
                && (bool) $this->front->Request()->getParam('voteConfirmed', false) === false
            ) {
                /** @var CaptchaValidator $captchaValidator */
                $captchaValidator = Shopware()->Container()->get('shopware.captcha.validator');

                if (!$captchaValidator->validateByName($config->get('newsletterCaptcha')$this->front->Request())) {
                    return [
                        'code' => 7,
                    ];
                }
            }

            
Home | Imprint | This part of the site doesn't use cookies.