Changeset 10928
- Timestamp:
- 04/27/2021 04:24:21 AM (3 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php
r10901 r10928 2 2 3 3 class User_Registrations_List_Table extends WP_List_Table { 4 5 function get_views() { 6 global $wpdb; 7 8 $views = [ 9 [ 10 'all', 11 'All', 12 ], 13 [ 14 'pending', 15 'Pending Email Confirmation', 16 ], 17 [ 18 'registered', 19 'Completed registration', 20 ], 21 [ 22 'spam', 23 'Caught in spam', 24 ], 25 [ 26 'akismet', 27 'Akismet said no', 28 ] 29 ]; 30 31 $default = 'all'; 32 $current_view = $_REQUEST['view'] ?? $default; 33 34 if ( isset( $_GET['s'] ) ) { 35 $default = 'search'; 36 $views[0] = [ 37 'search', 'All search results' 38 ]; 39 40 array_unshift( $views, [ 'all', 'All' ] ); 41 42 if ( 'all' === $current_view ) { 43 $current_view = 'search'; 44 } 45 } 46 47 return array_map( 48 function( $item ) use ( $current_view ) { 49 global $wpdb; 50 51 $count = $wpdb->get_var( 52 "SELECT count(*) FROM {$wpdb->base_prefix}user_pending_registrations WHERE " . 53 $this->get_where_sql( $item[0] ) 54 ); 55 56 $url = admin_url( 'index.php?page=user-registrations' ); 57 if ( !empty( $_GET['s'] ) && 'all' != $item[0] ) { 58 $url = add_query_arg( 's', urlencode( $_GET['s'] ), $url ); 59 } 60 61 $url = add_query_arg( 'view', $item[0], $url ); 62 63 return sprintf( 64 '<a href="%s" class="%s">%s <span class="count">(%s)</span></a>', 65 $url, 66 $current_view === $item[0] ? 'current' : '', 67 $item[1], 68 number_format_i18n( $count ), 69 ); 70 }, $views 71 ); 72 } 73 74 protected function get_view_sql_where( $view ) { 75 switch ( $view ) { 76 case 'pending': 77 return 'created = 0 AND cleared = 1'; 78 case 'spam': 79 return 'cleared = 0'; 80 case 'akismet': 81 return "meta LIKE '%akismet_result\":\"spam%'"; 82 case 'registered': 83 return 'created = 1'; 84 default: 85 case 'all': 86 return '1=1'; 87 } 88 } 89 90 protected function get_where_sql( $view = null ) { 91 global $wpdb; 92 93 $where = $this->get_view_sql_where( $view ?: ( $_REQUEST['view'] ?? 'all' ) ); 94 95 if ( isset( $_GET['s'] ) && 'all' != $view ) { 96 $search_like = '%' . $wpdb->esc_like( wp_unslash( $_GET['s'] ) ) . '%'; 97 $where .= $wpdb->prepare( 98 " AND ( user_login LIKE %s OR user_email LIKE %s OR meta LIKE %s )", 99 $search_like, $search_like, $search_like 100 ); 101 } 102 103 return $where; 104 } 4 105 5 106 function get_columns() { 6 107 return [ 7 'pending_id' => 'ID',8 'created' => 'Created',9 108 'user_login' => 'User Login', 10 'user_email' => 'User Email', 11 'user_ip' => 'IP', 12 'scores' => 'reCaptcha', 13 'akismet' => 'Akismet', 14 'user_registered' => 'Registered Date', 15 'created_date' => 'Created Date', 109 'meta' => 'Meta', 110 'scores' => 'Anti-spam<br>reCaptcha Akismet', 111 'user_registered' => 'Registered', 16 112 ]; 17 113 } … … 19 115 public function get_sortable_columns() { 20 116 return [ 21 'pending_id' => array( 'pending_id', false ),22 'created' => array( 'created', true ),23 117 'user_login' => array( 'user_login', true ), 24 'user_email' => array( 'user_email', true ),25 118 'scores' => array( 'scores', true ), 26 'akismet' => array( 'akismet', true ),27 119 'user_registered' => array( 'user_registered', true ), 28 'created_date' => array( 'created_date', true ),29 120 ]; 30 121 } … … 52 143 $current_page = $this->get_pagenum(); 53 144 54 $where = '1 = 1 '; 55 if ( isset( $_GET['s'] ) ) { 56 $search_like = '%' . $wpdb->esc_like( $_GET['s'] ) . '%'; 57 $where .= $wpdb->prepare( 58 "AND ( user_login LIKE %s OR user_email LIKE %s OR meta LIKE %s )", 59 $search_like, $search_like, $search_like 60 ); 61 } 145 $where = $this->get_where_sql(); 62 146 63 147 $per_page_offset = ($current_page-1) * $per_page; … … 82 166 } 83 167 84 function column_created( $item ) {85 echo ( $item->created ? 'Yes' : 'No' );86 87 if ( ! $item->created ) {88 $url = add_query_arg(89 'email',90 urlencode( $item->user_email ),91 admin_url( 'admin-post.php?action=login_resend_email' )92 );93 $url = wp_nonce_url( $url, 'resend_' . $item->user_email );94 echo $this->row_actions( [95 'resend' => '<a href="' . esc_url( $url ) . '">Resend Email</a>',96 ] );97 }98 }99 100 168 function column_user_registered( $item ) { 101 169 printf( … … 104 172 human_time_diff( strtotime( $item->user_registered ) ) 105 173 ); 106 } 107 108 function column_created_date( $item ) { 174 109 175 if ( $item->created_date && '0000-00-00 00:00:00' !== $item->created_date ) { 110 176 printf( 111 '< abbr title="%s">%s ago</abbr>',177 '<br>Created: <abbr title="%s">%s ago</abbr>', 112 178 esc_attr( $item->created_date ), 113 179 human_time_diff( strtotime( $item->created_date ) ) 114 180 ); 115 } else {116 echo ' ';117 181 } 118 182 } … … 122 186 $url = esc_url( 'https://profiles.wordpress.org/' . $item->user_login . '/' ); 123 187 echo "<a href='$url'>" . esc_html( $item->user_login ) . '</a>'; 188 189 if ( 190 ( $user = get_user_by( 'login', $item->user_login ) ) && 191 'BLOCKED' === substr( $user->user_pass, 0, 7 ) 192 ) { 193 echo ' <span class="delete-red">(blocked)</span>'; 194 } 195 124 196 } else { 125 197 echo esc_html( $item->user_login ); 126 198 } 127 } 128 129 function column_user_email( $item ) { 199 200 echo '<hr>'; 201 130 202 list( $email_user, $domain ) = explode( '@', $item->user_email, 2 ); 131 203 … … 136 208 esc_html( $domain ) 137 209 ); 138 } 139 140 141 function column_user_ip( $item ) { 210 211 $row_actions = []; 212 213 if ( ! $item->created && $item->cleared ) { 214 $url = add_query_arg( 215 'email', 216 urlencode( $item->user_email ), 217 admin_url( 'admin-post.php?action=login_resend_email' ) 218 ); 219 $url = wp_nonce_url( $url, 'resend_' . $item->user_email ); 220 221 $row_actions['resend'] = '<a href="' . esc_url( $url ) . '">Resend Email</a>'; 222 } 223 224 if ( ! $item->created ) { 225 if ( $item->user_activation_key ) { 226 $url = add_query_arg( 227 'email', 228 urlencode( $item->user_email ), 229 admin_url( 'admin-post.php?action=login_block' ) 230 ); 231 $url = wp_nonce_url( $url, 'block_' . $item->user_email ); 232 233 $row_actions['block'] = '<a href="' . esc_url( $url ) . '">Block Registration</a>'; 234 } 235 236 $url = add_query_arg( 237 'email', 238 urlencode( $item->user_email ), 239 admin_url( 'admin-post.php?action=login_delete' ) 240 ); 241 $url = wp_nonce_url( $url, 'delete_' . $item->user_email ); 242 243 $row_actions['delete'] = '<a href="' . esc_url( $url ) . '">Delete</a>'; 244 245 } else { 246 $url = add_query_arg( 247 'email', 248 urlencode( $item->user_email ), 249 admin_url( 'admin-post.php?action=login_block_account' ) 250 ); 251 $url = wp_nonce_url( $url, 'block_account_' . $item->user_email ); 252 253 if ( 254 ! ( $user = get_user_by( 'login', $item->user_login ) ) || 255 'BLOCKED' !== substr( $user->user_pass, 0, 7 ) 256 ) { 257 $row_actions['block-account'] = '<a href="' . esc_url( $url ) . '">Block Account</a>'; 258 } 259 260 } 261 262 if ( $row_actions ) { 263 echo $this->row_actions( $row_actions ); 264 } 265 266 } 267 268 269 function column_meta( $item ) { 142 270 $meta = json_decode( $item->meta ); 143 271 … … 158 286 ) 159 287 ); 288 echo '<hr>'; 289 290 foreach ( [ 'url', 'from', 'occ', 'interests' ] as $field ) { 291 if ( !empty( $meta->$field ) ) { 292 printf( "%s: %s<br>", esc_html( $field ), esc_html( $meta->$field ) ); 293 } 294 } 160 295 } 161 296 162 297 function column_scores( $item ) { 298 299 echo ( $item->cleared ? 'Passed' : 'Failed' ) . '<br>'; 300 163 301 foreach ( json_decode( $item->scores ) as $type => $val ) { 164 302 printf( … … 168 306 ); 169 307 } 170 } 171 172 function column_akismet( $item ) { 173 $meta = json_decode( $item->meta, true ); 174 175 echo $meta['akismet_result'] ?? ''; 308 309 $meta = json_decode( $item->meta ); 310 $akismet = $meta->akismet_result ?? ''; 311 if ( $akismet ) { 312 printf( 313 '<abbr title="%s">%s</abbr> ', 314 esc_attr( 'Akismet' ), 315 esc_html( strtolower( $akismet ) ) 316 ); 317 } 318 319 $row_actions = []; 320 321 if ( ! $item->created && $item->user_activation_key ) { 322 $url = add_query_arg( 323 'email', 324 urlencode( $item->user_email ), 325 admin_url( 'admin-post.php?action=login_block' ) 326 ); 327 $url = wp_nonce_url( $url, 'block_' . $item->user_email ); 328 329 $row_actions['block'] = '<a href="' . esc_url( $url ) . '">Block Registration</a>'; 330 } 331 332 if ( ! $item->cleared ) { 333 $url = add_query_arg( 334 'email', 335 urlencode( $item->user_email ), 336 admin_url( 'admin-post.php?action=login_mark_as_cleared' ) 337 ); 338 $url = wp_nonce_url( $url, 'clear_' . $item->user_email ); 339 $row_actions['approve-reg'] = '<a href="' . esc_url( $url ) . '">Approve</a>'; 340 } 341 342 if ( $row_actions ) { 343 echo $this->row_actions( $row_actions ); 344 } 176 345 } 177 346 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/ui.php
r10029 r10928 13 13 }); 14 14 15 function wporg_login_admin_action_text( $action ) { 16 switch ( $action ) { 17 case 'resent-email': 18 return 'The registration email has been resent.'; 19 case 'approved': 20 return 'The registration has been approved, and a confirmation email has been sent.'; 21 case 'deleted': 22 return 'The registration record has been removed.'; 23 case 'blocked': 24 return 'The registration has been blocked.'; 25 case 'blocked_account': 26 return 'Account blocked.'; 27 default: 28 return 'Action performed.'; 29 } 30 } 31 15 32 function wporg_login_admin_page() { 16 33 $wp_list_table = new User_Registrations_List_Table(); 17 34 $wp_list_table->prepare_items(); 18 35 19 echo '<style> 36 ?><script> 37 jQuery( document ).ready( function($) { 38 $( 'table .row-actions a' ).click( function( e ) { 39 e.preventDefault(); 40 41 var $this = $(this), 42 $tr = $this.parents('tr'), 43 $tds = $tr.find( 'td:not(:first)' ); 44 45 $tds.remove(); 46 $tr.find( '.row-actions' ).remove(); 47 $tr.append( "<td colspan=" + $tds.length + ">...</td>" ); 48 49 var url = $this.prop('href') + '&ajax=1'; 50 51 $.get( url, function( data ) { 52 $tr.find('td:last').text( data ); 53 } ); 54 }); 55 } ); 56 </script> 57 <style> 20 58 table.dashboard_page_user-registrations td > a { 21 59 color: inherit; … … 24 62 text-decoration: underline; 25 63 } 26 </style>'; 64 table.dashboard_page_user-registrations .delete-red { 65 color: #b32d2e; 66 } 67 </style> 68 <?php 27 69 28 70 echo '<div class="wrap">'; … … 30 72 echo '<hr class="wp-header-end">'; 31 73 32 if ( isset( $_REQUEST['resent-email'] ) ) { 33 echo '<div class="updated notice"><p>The registration email has been resent.</p></div>'; 74 if ( isset( $_GET['action'] ) ) { 75 echo '<div class="updated notice"><p>'; 76 echo wporg_login_admin_action_text( $_GET['action'] ); 77 echo '</p></div>'; 34 78 } 35 79 … … 37 81 printf( '<input type="hidden" name="page" value="%s">', esc_attr( $_GET['page'] ) ); 38 82 39 //$wp_list_table->views();83 $wp_list_table->views(); 40 84 $wp_list_table->search_box( 'Search', 's' ); 41 85 $wp_list_table->display(); … … 58 102 } 59 103 60 wp_safe_redirect( add_query_arg( 61 's', 62 urlencode( $email ), 63 'https://login.wordpress.org/wp-admin/index.php?page=user-registrations&resent-email=true' 64 ) ); 65 exit; 66 }); 104 if ( isset( $_GET['ajax'] ) ) { 105 die( wporg_login_admin_action_text( 'resent-email' ) ); 106 } 107 108 wp_safe_redirect( add_query_arg( 109 's', 110 urlencode( $email ), 111 'https://login.wordpress.org/wp-admin/index.php?page=user-registrations&action=resent-email' 112 ) ); 113 exit; 114 } ); 115 116 add_action( 'admin_post_login_mark_as_cleared', function() { 117 if ( ! current_user_can( 'manage_users' ) ) { 118 wp_die(); 119 } 120 121 $email = $_REQUEST['email'] ?? ''; 122 123 check_admin_referer( 'clear_' . $email ); 124 125 $user = wporg_get_pending_user( $email ); 126 if ( $user ) { 127 $user['cleared'] = 2; 128 wporg_update_pending_user( $user ); 129 130 wporg_login_send_confirmation_email( $user['user_email'] ); 131 } 132 133 if ( isset( $_GET['ajax'] ) ) { 134 die( wporg_login_admin_action_text( 'approved' ) ); 135 } 136 137 wp_safe_redirect( add_query_arg( 138 's', 139 urlencode( $email ), 140 'https://login.wordpress.org/wp-admin/index.php?page=user-registrations&action=approved' 141 ) ); 142 exit; 143 } ); 144 145 add_action( 'admin_post_login_block', function() { 146 if ( ! current_user_can( 'manage_users' ) ) { 147 wp_die(); 148 } 149 150 $email = $_REQUEST['email'] ?? ''; 151 152 check_admin_referer( 'block_' . $email ); 153 154 $user = wporg_get_pending_user( $email ); 155 if ( $user ) { 156 $user['cleared'] = 0; 157 $user['user_activation_key'] = ''; 158 $user['user_profile_key'] = ''; 159 160 wporg_update_pending_user( $user ); 161 } 162 163 if ( isset( $_GET['ajax'] ) ) { 164 die( wporg_login_admin_action_text( 'blocked' ) ); 165 } 166 167 wp_safe_redirect( add_query_arg( 168 's', 169 urlencode( $email ), 170 'https://login.wordpress.org/wp-admin/index.php?page=user-registrations&action=blocked' 171 ) ); 172 exit; 173 } ); 174 175 add_action( 'admin_post_login_delete', function() { 176 if ( ! current_user_can( 'manage_users' ) ) { 177 wp_die(); 178 } 179 180 $email = $_REQUEST['email'] ?? ''; 181 182 check_admin_referer( 'delete_' . $email ); 183 184 $user = wporg_get_pending_user( $email ); 185 if ( $user ) { 186 wporg_delete_pending_user( $user ); 187 } 188 189 if ( isset( $_GET['ajax'] ) ) { 190 die( wporg_login_admin_action_text( 'deleted' ) ); 191 } 192 193 wp_safe_redirect( add_query_arg( 194 's', 195 urlencode( $email ), 196 'https://login.wordpress.org/wp-admin/index.php?page=user-registrations&action=deleted' 197 ) ); 198 exit; 199 } ); 200 201 add_action( 'admin_post_login_block_account', function() { 202 if ( ! current_user_can( 'manage_users' ) ) { 203 wp_die(); 204 } 205 206 $email = $_REQUEST['email'] ?? ''; 207 208 check_admin_referer( 'block_account_' . $email ); 209 210 $user = get_user_by( 'email', $email ); 211 if ( $user && defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) ) { 212 // Load the support forums.. 213 include_once WP_PLUGIN_DIR . '/bbpress/bbpress.php'; 214 include_once WP_PLUGIN_DIR . '/support-forums/support-forums.php'; 215 216 // Then switch to it (Must be done after bbPress is loaded to get roles) 217 switch_to_blog( WPORG_SUPPORT_FORUMS_BLOGID ); 218 219 // Set the user to blocked. Support forum hooks will take care of the rest. 220 bbp_set_user_role( $user->ID, bbp_get_blocked_role() ); 221 222 restore_current_blog(); 223 } 224 225 if ( isset( $_GET['ajax'] ) ) { 226 die( wporg_login_admin_action_text( 'blocked_account' ) ); 227 } 228 229 wp_safe_redirect( add_query_arg( 230 's', 231 urlencode( $email ), 232 'https://login.wordpress.org/wp-admin/index.php?page=user-registrations&action=blocked_account' 233 ) ); 234 exit; 235 } ); 236 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r10902 r10928 1 1 <?php 2 2 3 function wporg_login_check_recapcha_status( $check_v3_action = false ) {3 function wporg_login_check_recapcha_status( $check_v3_action = false, $block_low_scores = true ) { 4 4 5 5 // reCaptcha V3 Checks … … 22 22 23 23 // Block super-low scores. 24 if ( (float)$result['score'] < (float) get_option( 'recaptcha_v3_threshold', 0.2 ) ) {24 if ( $block_low_scores && (float)$result['score'] < (float) get_option( 'recaptcha_v3_threshold', 0.2 ) ) { 25 25 return false; 26 26 } … … 122 122 } 123 123 124 $pending_user['meta']['akismet_result'] = wporg_login_check_akismet( $user_login, $user_email ); 125 126 $pending_user['cleared'] = ( 127 'spam' !== $pending_user['meta']['akismet_result'] && 128 (float)$pending_user['scores']['pending'] >= (float) get_option( 'recaptcha_v3_threshold', 0.2 ) 129 ); 130 124 131 $inserted = wporg_update_pending_user( $pending_user ); 125 132 if ( ! $inserted ) { … … 147 154 $user = wporg_get_pending_user( $user ); 148 155 149 if ( ! $user || $user['created'] ) {156 if ( ! $user || $user['created'] || ! $user['cleared'] ) { 150 157 return false; 151 158 } … … 230 237 } 231 238 239 } 240 241 function wporg_delete_pending_user( $pending_user ) { 242 global $wpdb; 243 244 if ( empty( $pending_user['pending_id'] ) ) { 245 return false; 246 } 247 248 return $wpdb->delete( 249 "{$wpdb->base_prefix}user_pending_registrations", 250 array( 'pending_id' => $pending_user['pending_id'] ) 251 ); 232 252 } 233 253 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-restapi.php
r10295 r10928 122 122 123 123 $pending_user = wporg_get_pending_user( $request['account'] ); 124 if ( ! $pending_user || $pending_user['created'] ) {124 if ( ! $pending_user || $pending_user['created'] || ! $pending_user['user_activation_key'] ) { 125 125 return $success_message; 126 126 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-create.php
r10901 r10928 6 6 */ 7 7 8 // Clear the pending cookies, they're no longer needed. 9 if ( isset( $_COOKIE['wporg_profile_user'] ) ) { 10 setcookie( 'wporg_profile_user', false, time()-DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 11 setcookie( 'wporg_profile_key', false, time()-DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 12 } 8 $sso = WPOrg_SSO::get_instance(); 13 9 14 10 // Migrate to cookies. 15 if ( !empty( WP_WPOrg_SSO::$matched_route_params['confirm_user'] ) ) {16 setcookie( 'wporg_confirm_user', WP_WPOrg_SSO::$matched_route_params['confirm_user'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true );17 setcookie( 'wporg_confirm_key', WP_WPOrg_SSO::$matched_route_params['confirm_key'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true );11 if ( !empty( $sso::$matched_route_params['confirm_user'] ) ) { 12 setcookie( 'wporg_confirm_user', $sso::$matched_route_params['confirm_user'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 13 setcookie( 'wporg_confirm_key', $sso::$matched_route_params['confirm_key'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 18 14 19 15 wp_safe_redirect( '/register/create' ); … … 60 56 } 61 57 62 63 $error_recapcha_status = $error_akismet = false; 64 if ( isset( $_POST['user_pass'] ) ) { 58 $error_recapcha_status = false; 59 if ( isset( $_POST['user_pass'] ) && 2 !== $pending_user['cleared'] ) { 65 60 66 61 // Check reCaptcha status 67 if ( ! wporg_login_check_recapcha_status( 'pending_create' ) ) {68 // No no. "Please try again."62 if ( ! wporg_login_check_recapcha_status( 'pending_create', false ) ) { 63 unset( $_POST['user_pass'] ); 69 64 $error_recapcha_status = true; 70 unset( $_POST['user_pass'] ); 71 } 72 73 // Check Akismet 74 $akismet = wporg_login_check_akismet( 65 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 71 // Store for reference. 72 if ( isset( $_POST['_reCaptcha_v3_token'] ) ) { 73 $recaptcha_api = wporg_login_recaptcha_api( 74 $_POST['_reCaptcha_v3_token'], 75 RECAPTCHA_V3_PRIVKEY 76 ); 77 $pending_user['scores']['create_attempt'] = -1; 78 if ( $recaptcha_api && $recaptcha_api['success'] && 'pending_create' == $recaptcha_api['action'] ) { 79 $pending_user['scores']['create_attempt'] = $recaptcha_api['score']; 80 } 81 } 82 } 83 84 // Check Akismet with new profile information 85 $pending_user['meta']['akismet_result'] = wporg_login_check_akismet( 75 86 $pending_user['user_login'], 76 87 $pending_user['user_email'], … … 83 94 ); 84 95 85 // Store for reference. 86 $pending_user['meta']['akismet_result'] = $akismet; 96 if ( 'spam' === $pending_user['meta']['akismet_result'] ) { 97 $pending_user['cleared'] = 0; 98 unset( $_POST['user_pass'] ); 99 } 100 87 101 wporg_update_pending_user( $pending_user ); 88 89 if ( 'spam' == $akismet ) { 90 // No no. "Please try again." 91 $error_akismet = true; 92 unset( $_POST['user_pass'] ); 93 } 94 102 } 103 104 if ( ! $pending_user['cleared'] ) { 105 if ( ! empty( $_COOKIE['wporg_profile_user'] ) ) { 106 // Throw the user back to the pending screen after being detected as spam at this point. 107 wp_safe_redirect( '/register/create-profile/' ); 108 die(); 109 } 110 111 unset( $_POST['user_pass'] ); 95 112 } 96 113 … … 101 118 $user = wporg_login_create_user_from_pending( $pending_user, $user_pass ); 102 119 if ( $user ) { 120 121 // Clear the cookies, they're no longer needed. 122 setcookie( 'wporg_profile_user', false, time()-DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 123 setcookie( 'wporg_profile_key', false, time()-DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 103 124 setcookie( 'wporg_confirm_user', false, time()-DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 104 125 setcookie( 'wporg_confirm_key', false, time()-DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); … … 121 142 ?> 122 143 123 <p class="intro">124 <?php _e( 'Set your password and complete your WordPress.org Profile information.', 'wporg' ); ?>125 </p>126 127 144 <form name="registerform" id="registerform" action="" method="post"> 128 145 129 <p class="login-login"> 130 <label for="user_login"><?php _e( 'Username', 'wporg' ); ?></label> 131 <input type="text" disabled="disabled" class=" disabled" value="<?php echo esc_attr( $activation_user ); ?>" size="20" /> 132 </p> 133 134 <div class="user-pass1-wrap"> 146 <?php if ( ! $pending_user['cleared'] ) { ?> 147 <div class="message info"> 148 <p><?php 149 printf( 150 /* translators: %s Email address */ 151 __( 'Your account is pending approval. You will receive an email at %s to set your password when approved.', 'wporg' ) . '<br>' . 152 __( 'Please contact %s for more details.', 'wporg' ), 153 '<code>' . esc_html( $pending_user['user_email'] ) . '</code>', 154 '<a href="mailto:' . $sso::SUPPORT_EMAIL . '">' . $sso::SUPPORT_EMAIL . '</a>' 155 ); 156 ?></p> 157 </div> 158 <?php } ?> 159 160 <p class="intro"> 161 <?php _e( 'Set your password and complete your WordPress.org Profile information.', 'wporg' ); ?> 162 </p> 163 164 <p class="login-login"> 165 <label for="user_login"><?php _e( 'Username', 'wporg' ); ?></label> 166 <input type="text" disabled="disabled" class=" disabled" value="<?php echo esc_attr( $activation_user ); ?>" size="20" /> 167 </p> 168 169 <div class="user-pass1-wrap"> 135 170 <p> 136 171 <label for="pass1"><?php _e( 'Password', 'wporg' ); ?></label> … … 145 180 </div> 146 181 147 <!-- <p class="description indicator-hint"><?php _e( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).', 'wporg' ); ?></p> -->148 149 182 <?php 150 183 $fields = &$pending_user['meta']; 151 184 include __DIR__ . '/partials/register-profilefields.php'; 152 185 ?> 186 153 187 <?php 154 if ( $error_recapcha_status || $error_akismet) {188 if ( $error_recapcha_status ) { 155 189 echo '<div class="message error"><p>' . __( 'Please try again.', 'wporg' ) . '</p></div>'; 156 190 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-profile.php
r10898 r10928 6 6 */ 7 7 8 $sso = WPOrg_SSO::get_instance(); 9 8 10 // Migrate to cookies. 9 if ( !empty( WP_WPOrg_SSO::$matched_route_params['profile_user'] ) ) {10 setcookie( 'wporg_profile_user', WP_WPOrg_SSO::$matched_route_params['profile_user'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true );11 setcookie( 'wporg_profile_key', WP_WPOrg_SSO::$matched_route_params['profile_key'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true );11 if ( !empty( $sso::$matched_route_params['profile_user'] ) ) { 12 setcookie( 'wporg_profile_user', $sso::$matched_route_params['profile_user'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 13 setcookie( 'wporg_profile_key', $sso::$matched_route_params['profile_key'], time()+DAY_IN_SECONDS, '/register/', 'login.wordpress.org', true, true ); 12 14 13 15 wp_safe_redirect( '/register/create-profile' ); … … 54 56 <div class="message info"> 55 57 <p><?php 58 if ( $pending_user['cleared'] ) { 56 59 printf( 57 60 /* translators: %s Email address */ … … 61 64 esc_attr( $pending_user['user_email'] ) 62 65 ); 66 } else { 67 printf( 68 /* translators: %s Email address */ 69 __( 'Your account is pending approval. You will receive an email at %s to set your password when approved.', 'wporg' ) . '<br>' . 70 __( 'Please contact %s for more details.', 'wporg' ), 71 '<code>' . esc_html( $pending_user['user_email'] ) . '</code>', 72 '<a href="mailto:' . $sso::SUPPORT_EMAIL . '">' . $sso::SUPPORT_EMAIL . '</a>' 73 ); 74 } 63 75 ?></p> 64 76 </div> 65 77 66 78 <p class="intro"> 67 <?php _e( 'Complete your WordPress.org Profile information.', 'wporg' ); ?>79 <?php _e( 'Complete your WordPress.org Profile information.', 'wporg' ); ?> 68 80 </p> 69 81 … … 72 84 <input type="text" disabled="disabled" class=" disabled" value="<?php echo esc_attr( $profile_user ); ?>" size="20" /> 73 85 </p> 74 75 86 76 87 <?php -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/register.php
r10904 r10928 15 15 } 16 16 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; 18 18 if ( $_POST ) { 19 19 … … 34 34 // handle user registrations. 35 35 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 ) { 37 40 $error_recapcha_status = true; 38 41 } else { 39 $akismet = wporg_login_check_akismet( $user_login, $user_email );40 41 42 $tos_meta_key = WPOrg_SSO::TOS_USER_META_KEY; 42 43 $meta = [ 43 44 'user_mailinglist' => $user_mailinglist, 44 'akismet_result' => $akismet,45 45 $tos_meta_key => $terms_of_service, 46 46 ]; 47 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 } 48 wporg_login_create_pending_user( $user_login, $user_email, $meta ); 49 die(); 54 50 } 55 51 } … … 123 119 </p> 124 120 <?php 125 if ( $error_recapcha_status || $error_akismet) {121 if ( $error_recapcha_status ) { 126 122 echo '<div class="message error"><p>' . __( 'Please try again.', 'wporg' ) . '</p></div>'; 127 123 }
Note: See TracChangeset
for help on using the changeset viewer.