Redaxscript\Controller\Recover::_validate PHP Method

_validate() protected method

validate
Since: 3.0.0
protected _validate ( array $postArray = [] ) : array
$postArray array array of the post
return array
    protected function _validate($postArray = [])
    {
        $emailValidator = new Validator\Email();
        $captchaValidator = new Validator\Captcha();
        /* validate post */
        $messageArray = [];
        if (!$postArray['email']) {
            $messageArray[] = $this->_language->get('email_empty');
        } else {
            if ($emailValidator->validate($postArray['email']) === Validator\ValidatorInterface::FAILED) {
                $messageArray[] = $this->_language->get('email_incorrect');
            } else {
                if (!Db::forTablePrefix('users')->where('email', $postArray['email'])->findOne()->id) {
                    $messageArray[] = $this->_language->get('email_unknown');
                }
            }
        }
        if (Db::getSetting('captcha') > 0 && $captchaValidator->validate($postArray['task'], $postArray['solution']) === Validator\ValidatorInterface::FAILED) {
            $messageArray[] = $this->_language->get('captcha_incorrect');
        }
        return $messageArray;
    }