Skip to content

Instantly share code, notes, and snippets.

@eonarik
Created October 22, 2017 19:07
Show Gist options
  • Save eonarik/d8daa245182fabed43191cfe77ca3892 to your computer and use it in GitHub Desktop.
Save eonarik/d8daa245182fabed43191cfe77ca3892 to your computer and use it in GitHub Desktop.
modCaptcha FormIt hook
<?php
$values = $hook->getValues();
if (empty($values['captcha']))
{
$hook->addError('captcha', 'Введите символы с картинки');
return false;
}
// modCaptcha Extra required. http://modx.com/extras/package/modcaptcha
$result = $modx->runSnippet('modcaptcha.check_captcha', array(
"code" => $values['captcha'],
));
if ($result !== 'true')
{
$hook->addError('captcha', "Неверный проверочный код");
return false;
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment