/** * Validate if captcha code is correct. * * @param string $fieldName Name of the captcha field. * * @return bool */ public static function validateCaptcha($fieldName) { if (!validateNotEmpty($fieldName)) { return false; } if (!validateNoSpaces($fieldName)) { return false; } if (Request::getFieldValue($fieldName) != Session::get($fieldName)) { Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_CAPTCHA_CODE); return false; } return true; }
/** * Forget all cross session fields. * * @return bool */ public static function forgetFields() { return Session::remove('_post'); }