Making WordPress.org

Changeset 10948


Ignore:
Timestamp:
05/04/2021 06:35:00 AM (5 years ago)
Author:
dd32
Message:

Login: Avoid blocking a user signup via a recaptcha failure when the failure is probably caused by a double-submission..

The signup user will still have to successfully complete the signup again, but a double-submission of the form a second time is less likely.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions.php

    r10947 r10948  
    349349                );
    350350                if ( is_wp_error( $resp ) || 200 != wp_remote_retrieve_response_code( $resp ) ) {
    351 
    352                         trigger_error( 'reCaptcha: ' . ( is_wp_error( $resp ) ? $resp->get_error_message() : wp_remote_retrieve_response_code( $resp ) . wp_remote_retrieve_body( $resp ) ), E_USER_NOTICE );
    353 
    354351                        $cache[ $cache_key ] = false;
    355352                        return false;
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-create.php

    r10947 r10948  
    6464                $error_recapcha_status = true;
    6565
    66                 // Allow a recaptcha fail to try again, but if they're blocked due to low score, mark them as needing approval.
    67                 if ( ! wporg_login_check_recapcha_status( 'pending_create', true ) ) {
    68                         $pending_user['cleared'] = 0;
    69                 }
    70 
    7166                // Store for reference.
    7267                if ( isset( $_POST['_reCaptcha_v3_token'] ) ) {
    … …  
    7570                                RECAPTCHA_V3_PRIVKEY
    7671                        );
    77                         $pending_user['scores']['create_attempt'] = -1;
    7872                        if ( $recaptcha_api && $recaptcha_api['success'] && 'pending_create' == $recaptcha_api['action'] ) {
    7973                                $pending_user['scores']['create_attempt'] = $recaptcha_api['score'];
    80                         } else {
    81                                 // Debug.
    82                                 $pending_user['meta']['recaptcha_debug'] = $recaptcha_api;
    83                         }
     74                        } // else: probably `timeout-or-duplicate` or w.org network error.
     75                }
     76
     77                // Allow a recaptcha fail to try again, but if they're blocked due to low score, mark them as needing approval.
     78                if (
     79                        ! empty( $pending_user['scores']['create_attempt'] ) &&
     80                        (float) $pending_user['scores']['create_attempt'] < (float) get_option( 'recaptcha_v3_threshold', 0.2 )
     81                ) {
     82                        $pending_user['cleared'] = 0;
    8483                }
    8584        }
Note: See TracChangeset for help on using the changeset viewer.