Making WordPress.org


Ignore:
Timestamp:
10/09/2019 07:07:07 AM (5 years ago)
Author:
dd32
Message:

Login: Require a valid reCaptcha v3 score during registration, add reCaptcha to the account confirmation screen as well.

See #4739.

File:
1 edited

Legend:

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

    r9146 r9167  
    4242}
    4343
     44// Check reCaptcha status
     45$error_recapcha_status = false;
     46if ( isset( $_POST['user_pass'] ) ) {
     47    if ( ! wporg_login_check_recapcha_status( 'pending_create' ) ) {
     48        // No no. "Please try again."
     49        $error_recapcha_status = true;
     50        unset( $_POST['user_pass'] );
     51    }
     52}
     53
     54if ( wporg_login_save_profile_fields( $pending_user ) ) {
     55    // re-fetch the user, it's probably changed.
     56    $pending_user = wporg_get_pending_user( $activation_user );
     57}
     58
    4459if ( isset( $_POST['user_pass'] ) ) {
    4560    $user_pass = wp_unslash( $_POST['user_pass'] );
     
    5267        }
    5368    }
    54 
    55     wporg_login_save_profile_fields();
    5669
    5770    wp_safe_redirect( 'https://wordpress.org/support/' );
     
    91104        include __DIR__ . '/partials/register-profilefields.php';
    92105    ?>
     106    <?php
     107        if ( $error_recapcha_status ) {
     108            echo '<div class="message error"><p>' . __( 'Please try again.', 'wporg' ) . '</p></div>';
     109        }
     110    ?>
    93111
    94112    <p class="login-submit">
    95         <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary" value="<?php esc_attr_e( 'Create Account', 'wporg' ); ?>" />
     113        <input data-sitekey="<?php echo esc_attr( RECAPTCHA_INVIS_PUBKEY ); ?>" data-callback='onSubmit' type="submit" name="wp-submit" id="wp-submit" class="g-recaptcha button button-primary button-large" value="<?php esc_attr_e( 'Create Account', 'wporg' ); ?>" />
    96114    </p>
    97115
Note: See TracChangeset for help on using the changeset viewer.