protected function _validate($postArray = [], $user = null)
{
$passwordValidator = new Validator\Password();
$captchaValidator = new Validator\Captcha();
/* validate post */
$messageArray = [];
if (!$postArray['user']) {
$messageArray[] = $this->_language->get('user_empty');
} else {
if (!$user->id) {
$messageArray[] = $this->_language->get('user_incorrect');
}
}
if (!$postArray['password']) {
$messageArray[] = $this->_language->get('password_empty');
} else {
if ($user->password && $passwordValidator->validate($postArray['password'], $user->password) === Validator\ValidatorInterface::FAILED) {
$messageArray[] = $this->_language->get('password_incorrect');
}
}
if (Db::getSetting('captcha') > 0 && $captchaValidator->validate($postArray['task'], $postArray['solution']) === Validator\ValidatorInterface::FAILED) {
$messageArray[] = $this->_language->get('captcha_incorrect');
}
return $messageArray;
}