Created
October 22, 2017 19:07
-
-
Save eonarik/d8daa245182fabed43191cfe77ca3892 to your computer and use it in GitHub Desktop.
modCaptcha FormIt hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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