Making WordPress.org


Ignore:
Timestamp:
04/27/2021 04:24:21 AM (4 years ago)
Author:
dd32
Message:

Login: Allow registrations with "low reCaptcha scores" to register, but go into a pending-moderation state.

This will allow legitimate users who receive a "Please try again" error to be manually approved.

This will also allow us to experiment with more aggressive anti-spam measures, as the majority of current spam registrations are human generated.

File:
1 edited

Legend:

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

    r10904 r10928  
    1515}
    1616
    17 $error_user_login = $error_user_email = $error_recapcha_status = $error_akismet = $terms_of_service_error = false;
     17$error_user_login = $error_user_email = $error_recapcha_status = $terms_of_service_error = false;
    1818if ( $_POST ) {
    1919
     
    3434    // handle user registrations.
    3535    if ( ! $error_user_login && ! $error_user_email && ! $terms_of_service_error ) {
    36         if ( ! wporg_login_check_recapcha_status( 'register' ) ) {
     36
     37        $recaptcha = wporg_login_check_recapcha_status( 'register', false /* Allow low scores to pass through */ );
     38
     39        if ( ! $recaptcha ) {
    3740            $error_recapcha_status = true;
    3841        } else {
    39             $akismet = wporg_login_check_akismet( $user_login, $user_email );
    40 
    4142            $tos_meta_key = WPOrg_SSO::TOS_USER_META_KEY;
    4243            $meta = [
    4344                'user_mailinglist' => $user_mailinglist,
    44                 'akismet_result'   => $akismet,
    4545                $tos_meta_key      => $terms_of_service,
    4646            ];
    4747
    48             if ( 'spam' === $akismet ) {
    49                 $error_akismet = true;
    50             } else {
    51                 wporg_login_create_pending_user( $user_login, $user_email, $meta );
    52                 die();
    53             }
     48            wporg_login_create_pending_user( $user_login, $user_email, $meta );
     49            die();
    5450        }
    5551    }
     
    123119    </p>
    124120    <?php
    125         if ( $error_recapcha_status || $error_akismet ) {
     121        if ( $error_recapcha_status ) {
    126122            echo '<div class="message error"><p>' . __( 'Please try again.', 'wporg' ) . '</p></div>';
    127123        }
Note: See TracChangeset for help on using the changeset viewer.