Changeset 444954
- Timestamp:
- 09/28/2011 08:03:57 PM (15 years ago)
- Location:
- picatcha/trunk
- Files:
-
- 1 added
- 3 edited
-
picatcha-settings.php (modified) (1 diff)
-
picatcha.php (modified) (10 diffs)
-
readme.txt (modified) (5 diffs)
-
screenshot-4.png (added)
Legend:
- Unmodified
- Added
- Removed
-
picatcha/trunk/picatcha-settings.php
r429974 r444954 94 94 </table> 95 95 96 <h3><?php _e('Lost Password', 'picatcha'); ?></h3> 97 <table class="form-table"> 98 <tr valign="top"> 99 <th scope="row"><?php _e('Activation', 'picatcha'); ?></th> 100 <td> 101 <input type="checkbox" id ="picatcha_options[show_in_lost_password]" name="picatcha_options[show_in_lost_password]" value="1" <?php checked('1', $this->options['show_in_lost_password']); ?> /> 102 <label for="picatcha_options[show_in_lost_password]"><?php _e('Enable for Lost password form', 'picatcha'); ?></label> 103 </td> 104 </tr> 105 106 <!-- keeping this here just in case we decide to implement it --> 107 <!-- <tr valign="top"> 108 <th scope="row"><?php //_e('Presentation', 'picatcha'); ?></th> 109 <td> 110 <label for="picatcha_options[registration_theme]"><?php //_e('Theme:', 'picatcha'); ?></label> 111 <?php //$this->theme_dropdown('registration'); ?> 112 </td> 113 </tr> 114 115 <tr valign="top"> 116 <th scope="row"><?php //_e('Tab Index', 'picatcha'); ?></th> 117 <td> 118 <input type="text" name="picatcha_options[registration_tab_index]" size="10" value="<?php //echo $this->options['registration_tab_index']; ?>" /> 119 </td> 120 </tr>--> 121 </table> 122 123 <h3><?php _e('Login form', 'picatcha'); ?></h3> 124 <table class="form-table"> 125 <tr valign="top"> 126 <th scope="row"><?php _e('Activation', 'picatcha'); ?></th> 127 <td> 128 <input type="checkbox" id ="picatcha_options[show_in_login]" name="picatcha_options[show_in_login]" value="1" <?php checked('1', $this->options['show_in_login']); ?> /> 129 <label for="picatcha_options[show_in_login]"><?php _e('Require for login', 'picatcha'); ?></label> 130 </td> 131 </tr> 132 133 <!-- keeping this here just in case we decide to implement it --> 134 <!-- <tr valign="top"> 135 <th scope="row"><?php //_e('Presentation', 'picatcha'); ?></th> 136 <td> 137 <label for="picatcha_options[registration_theme]"><?php //_e('Theme:', 'picatcha'); ?></label> 138 <?php //$this->theme_dropdown('registration'); ?> 139 </td> 140 </tr> 141 142 <tr valign="top"> 143 <th scope="row"><?php //_e('Tab Index', 'picatcha'); ?></th> 144 <td> 145 <input type="text" name="picatcha_options[registration_tab_index]" size="10" value="<?php //echo $this->options['registration_tab_index']; ?>" /> 146 </td> 147 </tr>--> 148 </table> 149 96 150 <h3><?php _e('General Options', 'picatcha'); ?></h3> 97 151 <table class="form-table"> -
picatcha/trunk/picatcha.php
r431402 r444954 38 38 if ($this->options['show_in_registration']) 39 39 add_action('login_head', array(&$this, 'registration_style')); // make unnecessary: instead use jQuery and add to the footer? 40 41 if($this->options['display_powered_by'])42 //WPPluginPicatcha::$displayPoweredBy=1;43 40 44 41 // options … … 53 50 else 54 51 add_action('register_form', array(&$this, 'show_picatcha_in_registration')); 52 } 53 54 if ($this->options['show_in_lost_password']){ 55 add_action('lostpassword_form', array(&$this, 'show_picatcha_in_registration')); 56 } 57 58 if($this->options['show_in_login']){ //$this->options['show_in_login'] 59 add_action('login_form', array(&$this, 'show_picatcha_in_registration')); 55 60 } 56 61 … … 83 88 else 84 89 add_filter('registration_errors', array(&$this, 'validate_picatcha_response')); 90 } 91 92 if($this->options['show_in_login']){ 93 if($this->is_multi_blog()){ 94 add_filter('login_errors', array(&$this, 'validate_picatcha_response_wpmu')); 95 } 96 else{ 97 add_filter('login_redirect', array(&$this, 'validate_picatcha_response_redirect'),10,3); 98 add_filter('login_errors', array(&$this, 'validate_picatcha_response')); 99 100 } 101 102 } 103 104 if($this->options['show_in_lost_password']){ 105 // picatcha validation 106 if ($this->is_multi_blog()) 107 add_filter('lostpassword_post', array(&$this, 'validate_picatcha_response_wpmu')); 108 else 109 add_filter('lostpassword_post', array(&$this, 'check_picatcha_lost_password')); //validate_picatcha_response 110 85 111 } 86 112 } … … 106 132 $option_defaults['show_in_comments'] = $old_options['re_comments']; // whether or not to show Picatcha on the comment post 107 133 $option_defaults['show_in_registration'] = $old_options['re_registration']; // whether or not to show Picatcha on the registration page 134 $option_defaults['show_in_lost_password'] = $old_options['show_in_lost_password']; // whether or not to show when the user loses his/her password 135 $option_defaults['show_in_login'] = $old_options['show_in_login']; // whether or not to require when the user is logging in 108 136 109 137 … … 139 167 $option_defaults['show_in_registration'] = 1; // whether or not to show Picatcha on the registration page 140 168 $option_defaults['display_powered_by'] = 1; //whether or not to show "Powered by Picatcha" 169 $option_defaults['show_in_lost_password'] = 0; //defaults to not show in password recovery page 170 $option_defaults['show_in_login'] = 0; //defaults to not show when the user logs in 141 171 142 172 // bypass levels … … 197 227 window.onload = function() { 198 228 document.getElementById('login').style.width = '{$width}px'; 199 document.getElementById('reg_passmail').style.marginTop = '10px';200 document.getElementById('picatcha_widget_div').style.marginBottom = '10px';229 if(document.getElementById('reg_passmail')){document.getElementById('reg_passmail').style.marginTop = '10px';} 230 if(document.getElementById('picatcha_widget_div')){document.getElementById('picatcha_widget_div').style.marginBottom = '10px';} 201 231 }; 202 232 </script> … … 243 273 $validated['show_in_comments'] = ($input['show_in_comments'] == 1 ? 1 : 0); 244 274 $validated['bypass_for_registered_users'] = ($input['bypass_for_registered_users'] == 1 ? 1: 0); 275 $validated['show_in_lost_password'] = ($input['show_in_lost_password'] == 1 ? 1: 0); 276 $validated['show_in_login'] = ($input['show_in_login'] == 1 ? 1: 0); 245 277 246 278 $capabilities = array ('read', 'edit_posts', 'publish_posts', 'moderate_comments', 'activate_plugins'); … … 302 334 } 303 335 336 //displays an error message in the captcha for the login screen 337 if(isset($_REQUEST['picatcha'])){ 338 switch ($_REQUEST['picatcha']){ 339 case 'empty': 340 echo "<b style='color: red;'>".$this->options['no_response_error']."</b>"; 341 break; 342 case 'incorrect': 343 echo "<b style='color: red;'>".$this->options['incorrect_response_error']."</b>"; 344 break; 345 } 346 } 347 304 348 // if it's for wordpress mu, show the errors 305 349 if ($this->is_multi_blog()) { … … 312 356 // for regular wordpress 313 357 else { 314 //echo out to see what the error is315 //echo "error: ". $rerror;316 358 echo $format . $this->get_picatcha_html($rerror, $use_ssl); 317 359 } … … 319 361 320 362 function validate_picatcha_response($errors) { 321 // empty so throw the empty response error 363 // if the user does not fill out picatcha, throw the empty response error 364 322 365 if (empty($_POST['picatcha']['r']) || $_POST['picatcha']['r'] == '') { 323 $errors->add('blank_captcha', $this->options['no_response_error']); 366 if(is_wp_error($errors)){ 367 $errors->add('blank_captcha', $this->options['no_response_error']); 368 }else{ 369 $errors .= $this->options['no_response_error']; 370 } 371 324 372 return $errors; 373 325 374 } 326 375 $response = picatcha_check_answer($this->options['private_key'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_POST['picatcha']['token'], $_POST['picatcha']['r']); 327 376 328 377 // response is bad, add incorrect response error 378 329 379 if (!$response->is_valid) 380 if ($response->error == 'incorrect-answer'){ 381 382 383 if (is_wp_error($errors)) 384 $errors->add('captcha_wrong', $this->options['incorrect_response_error']); 385 if (!is_wp_error($errors)){ 386 387 // works for form errors 388 $errors .= $this->options['incorrect_response_error']; 389 } 390 } 391 return $errors; 392 } 393 394 395 function check_picatcha_lost_password(){ 396 if (empty($_POST['picatcha']['r']) || $_POST['picatcha']['r'] == ''){ 397 wp_die(__($this->options['no_response_error']. "<br/> Please click your browser's back button to try again.")); 398 } 399 400 //validate the captcha 401 $response = picatcha_check_answer($this->options['private_key'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_POST['picatcha']['token'], $_POST['picatcha']['r']); 402 403 if (!$response->is_valid){ 404 if ($response->error == 'incorrect-answer') 405 wp_die(__($this->options['incorrect_response_error']. "<br/> Please click your browser's back button to try again.")); 406 } 407 408 } 409 410 function validate_picatcha_response_redirect($url) { 411 //function to validate picatcha when the user is redirecting to a page.. ie if the username and password is correct 412 413 //check to see if the picatcha is filled out to begin with... 414 if (empty($_POST['picatcha']['r']) || $_POST['picatcha']['r'] == '') { 415 $_SESSION['rerror']= __('picatcha', 'The Picatcha is Empty!', 'picatcha'); 416 // Log the user out immediately 417 wp_logout(); 418 //return them to the login screen, passing along something to tell them the picatcha was wrong... 419 return $_SERVER['REQUEST_URI']."?picatcha=empty"; 420 } 421 422 $response = picatcha_check_answer($this->options['private_key'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_POST['picatcha']['token'], $_POST['picatcha']['r']); 423 424 //if it is filled out, then validate it... 425 426 if (!$response->is_valid){ 427 //echo "response is not valid"; 330 428 if ($response->error == 'incorrect-answer') 331 $errors->add('captcha_wrong', $this->options['incorrect_response_error']); 332 333 return $errors; 429 if (!is_wp_error($errors)){ 430 // works for form errors 431 //$url = '?picatcha='.$this->options['no_response_error']; 432 //return $url; 433 $PicatchaError = new WP_Error('Picatcha',__('Picatcha is wrong')); 434 return $_SERVER['REQUEST_URI']."?picatcha=incorrect"; 435 436 } 437 //if the user did not pass picatcha, logs them out immediately 438 wp_logout(); 439 }else{ 440 //user completed the captcha correctly 441 442 //return them to the main site 443 return site_url()."/wp-admin/"; //maybe add in an option to the preferences to redirect it to another page? say the root page or something else? 444 } 334 445 } 335 446 -
picatcha/trunk/readme.txt
r431402 r444954 5 5 Requires at least: 2.7.1 6 6 Tested up to: 3.2.1 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 9 Integrates P icatchaimage-identification CAPTCHA - anti-spam solution with WordPress including comment and registration.9 Integrates PICATCHA image-identification CAPTCHA - anti-spam solution with WordPress including comment and registration. 10 10 11 11 == Description == 12 12 13 = What is P icatcha? =13 = What is PICATCHA? = 14 14 15 15 PICATCHA(TM) is a unique image-identification CAPTCHA that effectively protects your website from Internet abuse - spam and automated bots. It is a well known fact that websites lose approximately 3-18% of user interactions (comments, sign-up etc) due to the additional burden of re-typing the squiggly garbled text CAPTCHAs. Imagine if your website is visited from a tablet device or a smartphone - the end user is left to zoom/pan, decipher the text and typing with auto-correction makes the whole experience frustrating. It is also inevitable that mobile Internet will eclipse desktop Internet, and we believe that as a website administrator you make the right CAPTCHA choice and be ready for this shift. … … 31 31 1. Upload the `picatcha` folder to the `/wp-content/plugins/` directory 32 32 2. Activate the plugin through the `Plugins` menu in WordPress 33 3. Get the P icatchakeys (Public and Private) [here](http://www.picatcha.com/signup)33 3. Get the PICATCHA keys (Public and Private) [here](http://www.picatcha.com/signup) 34 34 4. Add the Public/Private keys in Settings menu 35 35 … … 43 43 == ChangeLog == 44 44 45 = Version 1.1 = 46 * Added Picatcha to the login and lost password screens. 47 45 48 = Version 1.01 = 46 49 * Fixed a bug that prevented users from accessing the settings page … … 51 54 == Upgrade Notice == 52 55 53 = Version 1. 01 =54 If you are having trouble accessing the settings page for PICATCHA, this upgrade should fix the problem.56 = Version 1.1 = 57 Version 1.1 allows Wordpress admins to have users solve PICATCHAs on the login screen and lost password screen, in addition to previous bug fixes. 55 58 56 59 == Frequently Asked Questions == … … 66 69 == Screenshots == 67 70 68 1. The P icatchaSettings71 1. The PICATCHA Settings 69 72 70 2. P icatchain a comment form scaled down 50%73 2. PICATCHA in a comment form scaled down 50% 71 74 72 3. P icatchaon the registration form of Wordpress75 3. PICATCHA on the registration form of Wordpress 73 76 77 4. PICATCHA on the login form of Wordpress
Note: See TracChangeset
for help on using the changeset viewer.