Contao\FormCaptcha::validate PHP Метод

validate() публичный Метод

Validate the input and set the value
public validate ( )
    public function validate()
    {
        /** @var SessionInterface $objSession */
        $objSession = \System::getContainer()->get('session');
        $arrCaptcha = $objSession->get('captcha_' . $this->strId);
        if (!is_array($arrCaptcha) || !strlen($arrCaptcha['key']) || !strlen($arrCaptcha['sum']) || \Input::post($arrCaptcha['key']) != $arrCaptcha['sum'] || $arrCaptcha['time'] > time() - 3) {
            $this->class = 'error';
            $this->addError($GLOBALS['TL_LANG']['ERR']['captcha']);
        }
        $objSession->set('captcha_' . $this->strId, '');
    }