Initial commit
This commit is contained in:
commit
dd5c051eb9
6 files changed
+2394
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
function display_login_captcha() {
|
||||
require_once get_stylesheet_directory().'/wl_functions/wl_captcha/securimage.php';
|
||||
$options = array();
|
||||
$options['input_name'] = 'wl_security_code'; // change the name of input element for form post
|
||||
// $options['input_id'] = 'captcha_code'; // change id of the input element for form post
|
||||
// $options['input_text'] = 'Type the text:'; // change text of the label for the captcha text input
|
||||
// $options['input_attributes'] = array('data-id'=>27); // An array of additional HTML tag attributes to pass to the text input tag
|
||||
// $options['image_id'] = 'captcha_image'; // change the name of the alt text of the image
|
||||
// $options['image_attributes'] = array('data-id'=>27); //An array of additional HTML tag attributes to pass to the captcha image tag
|
||||
// $options['error_html'] = '<div style="color:red">*Some important text!!!</div>'; //Optional HTML markup to be shown above the text input field
|
||||
// $options['namespace'] = 'some_namespace'; //The optional captcha namespace to use for showing the image. Namespaces are for using multiple captchas on the same page.
|
||||
|
||||
echo "<div id='captcha_container'>\n";
|
||||
echo Securimage::getCaptchaHtml($options);
|
||||
echo "\n</div>\n";
|
||||
?>
|
||||
|
||||
<?php
|
||||
}
|
||||
add_action( "login_form", "display_login_captcha" );
|
||||
|
||||
function verify_login_captcha($user, $password) {
|
||||
|
||||
$captcha = @$_POST['security_code']; // the user's entry for the captcha code
|
||||
require_once get_stylesheet_directory().'/wl_functions/wl_captcha/securimage.php';
|
||||
|
||||
$securimage = new Securimage();
|
||||
|
||||
if ($securimage->check($captcha) == false) {
|
||||
return new WP_Error("Captcha Invalid", __("<strong>ERROR</strong>: You are a bot. If not, then enable JavaScript"));
|
||||
}else{
|
||||
return $user;
|
||||
}
|
||||
|
||||
}
|
||||
add_filter("wp_authenticate_user", "verify_login_captcha", 10, 2);
|
||||
Reference in new issue
Block a user