Changeset 10901
- Timestamp:
- 04/14/2021 04:49:37 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php
r10010 r10901 11 11 'user_ip' => 'IP', 12 12 'scores' => 'reCaptcha', 13 'akismet' => 'Akismet', 13 14 'user_registered' => 'Registered Date', 14 15 'created_date' => 'Created Date', … … 23 24 'user_email' => array( 'user_email', true ), 24 25 'scores' => array( 'scores', true ), 26 'akismet' => array( 'akismet', true ), 25 27 'user_registered' => array( 'user_registered', true ), 26 28 'created_date' => array( 'created_date', true ), … … 168 170 } 169 171 172 function column_akismet( $item ) { 173 $meta = json_decode( $item->meta, true ); 174 175 echo $meta['akismet_result'] ?? ''; 176 } 177 170 178 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r10900 r10901 63 63 $akismet = Akismet::rest_auto_check_comment( $payload ); 64 64 if ( is_wp_error( $akismet ) ) { 65 return 'OK'; // Assume it's okay in the event of failure / unknown. 66 // return $akismet->get_error_code(); 67 } 68 69 if ( ! empty( $akismet['akismet_pro_tip'] ) ) { 70 return $akismet['akismet_pro_tip']; 65 return $akismet->get_error_code(); 66 } 67 68 if ( ! empty( $akismet['akismet_pro_tip'] ) && 'discard' === $akismet['akismet_pro_tip'] ) { 69 return 'spam'; 71 70 } elseif ( 'true' === $akismet['akismet_result'] ) { 72 71 return 'spam'; … … 74 73 return 'OK'; 75 74 } else { 76 return ' OK'; // Assume it's okay in the event of failure / unknown.75 return 'unknown'; 77 76 } 78 77 } … … 81 80 * Handles creating a "Pending" registration that will later be converted to an actual user account. 82 81 */ 83 function wporg_login_create_pending_user( $user_login, $user_email, $ user_mailinglist = false, $tos_revision = 0) {82 function wporg_login_create_pending_user( $user_login, $user_email, $meta = array() ) { 84 83 global $wpdb, $wp_hasher; 85 84 … … 98 97 $profile_key = wp_generate_password( 24, false, false ); 99 98 $hashed_profile_key = time() . ':' . wp_hash_password( $profile_key ); 100 101 $tos_meta_key = WPOrg_SSO::TOS_USER_META_KEY;102 99 103 100 $pending_user = array( … … 107 104 'user_activation_key' => '', 108 105 'user_profile_key' => $hashed_profile_key, 109 'meta' => array( 110 'user_mailinglist' => $user_mailinglist, 106 'meta' => $meta + array( 111 107 'registration_ip' => $_SERVER['REMOTE_ADDR'], // Spam & fraud control. Will be discarded after the account is created. 112 $tos_meta_key => $tos_revision,113 108 ), 114 109 'scores' => array() -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-create.php
r10900 r10901 83 83 ); 84 84 85 if ( 'OK' !== $akismet ) { 85 // Store for reference. 86 $pending_user['meta']['akismet_result'] = $akismet; 87 wporg_update_pending_user( $pending_user ); 88 89 if ( 'spam' == $akismet ) { 86 90 // No no. "Please try again." 87 91 $error_akismet = true; 88 92 unset( $_POST['user_pass'] ); 89 90 // Store for reference.91 $pending_user['meta']['akismet_result'] = $akismet;92 wporg_update_pending_user( $pending_user );93 93 } 94 94 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/register.php
r10900 r10901 36 36 if ( ! wporg_login_check_recapcha_status( 'register' ) ) { 37 37 $error_recapcha_status = true; 38 } elseif ( 'OK' !== wporg_login_check_akismet( $user_login, $user_email ) ) {39 $error_akismet = true;40 38 } else { 41 wporg_login_create_pending_user( $user_login, $user_email, $user_mailinglist, $terms_of_service ); 42 die(); 39 $akismet = wporg_login_check_akismet( $user_login, $user_email ); 40 41 $tos_meta_key = WPOrg_SSO::TOS_USER_META_KEY; 42 $meta = [ 43 'user_mailinglist' => $user_mailinglist, 44 'akismet_result' => $akismet, 45 $tos_meta_key => $terms_of_service, 46 ]; 47 48 if ( 'spam' === $akismet ) { 49 $error_akismet = true; 50 } else { 51 wporg_login_create_pending_user( $user_login, $user_email, $meta ); 52 die(); 53 } 43 54 } 44 55 }
Note: See TracChangeset
for help on using the changeset viewer.