Changeset 10981
- Timestamp:
- 05/17/2021 04:58:00 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r10964 r10981 326 326 * Save the user profile fields, potentially prior to user creation and prior to email confirmation. 327 327 */ 328 function wporg_login_save_profile_fields( $pending_user = false ) {328 function wporg_login_save_profile_fields( $pending_user = false, $state = '' ) { 329 329 if ( ! $_POST || empty( $_POST['user_fields'] ) ) { 330 330 return false; … … 358 358 } 359 359 360 $updated_email = false; 361 if ( 362 'pending' === $state && 363 empty( $pending_user['meta']['changed_email'] ) && // Only if they've not changed it before. 364 ! empty( $_POST['user_email'] ) && 365 wp_unslash( $_POST['user_email'] ) !== $pending_user['user_email'] 366 ) { 367 // Validate the email 368 $error_user_email = rest_do_request( new WP_REST_Request( 'GET', '/wporg/v1/email-in-use/' . wp_unslash( $_POST['user_email'] ) ) ); 369 if ( $error_user_email->get_data()['available'] ) { 370 // Change their email, resend confirmation. 371 $pending_user['meta']['changed_email'] = $pending_user['user_email']; 372 $pending_user['user_email'] = wp_unslash( $_POST['user_email'] ); 373 $pending_user['user_activation_key'] = ''; // Clear any existing email hash. 374 $updated_email = true; 375 376 // Validate heuristics. 377 if ( function_exists( 'wporg_registration_check_private_heuristics' ) ) { 378 // Returns block, review, allow. 379 $pending_user['meta']['heuristics'] = wporg_registration_check_private_heuristics( [ 380 'user_login' => $pending_user['user_login'], 381 'user_email' => $pending_user['user_email'] 382 ] ); 383 } 384 385 // If the new email fails our checks, and the user hasn't manually been approved.. 386 if ( 'allow' !== $pending_user['meta']['heuristics'] && $pending_user['cleared'] < 2 ) { 387 $pending_user['cleared'] = 0; 388 } 389 } 390 } 391 360 392 if ( $pending_user ) { 361 393 wporg_update_pending_user( $pending_user ); 394 if ( $updated_email ) { 395 wporg_login_send_confirmation_email( $pending_user ); 396 } 362 397 } 363 398 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions.php
r10948 r10981 57 57 */ 58 58 function wporg_login_replace_css() { 59 wp_enqueue_style( 'wporg-login', get_template_directory_uri() . '/stylesheets/login.css', array( 'login', 'dashicons' ), '20210 414' );59 wp_enqueue_style( 'wporg-login', get_template_directory_uri() . '/stylesheets/login.css', array( 'login', 'dashicons' ), '20210517' ); 60 60 } 61 61 add_action( 'login_init', 'wporg_login_replace_css' ); … … 73 73 74 74 wp_enqueue_style( 'wporg-normalize', get_template_directory_uri() . '/stylesheets/normalize.css', 3 ); 75 wp_enqueue_style( 'wporg-login', get_template_directory_uri() . '/stylesheets/login.css', array( 'login', 'dashicons' ), '20210 414' );75 wp_enqueue_style( 'wporg-login', get_template_directory_uri() . '/stylesheets/login.css', array( 'login', 'dashicons' ), '20210517' ); 76 76 } 77 77 add_action( 'wp_enqueue_scripts', 'wporg_login_scripts' ); … … 98 98 ); 99 99 100 wp_register_script( 'wporg-registration', get_template_directory_uri() . '/js/registration.js', array( 'recaptcha-api', 'jquery' ), '202 00707' );100 wp_register_script( 'wporg-registration', get_template_directory_uri() . '/js/registration.js', array( 'recaptcha-api', 'jquery' ), '20210517' ); 101 101 wp_localize_script( 'wporg-registration', 'wporg_registration', array( 102 'rest_url' => esc_url_raw( rest_url( "wporg/v1") )102 'rest_url' => esc_url_raw( rest_url( 'wporg/v1' ) ) 103 103 ) ); 104 104 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/js/registration.js
r10029 r10981 60 60 }); 61 61 62 $loginForm.on( 'click', '.change-email', function( e ) { 63 e.preventDefault(); 64 65 $(this).remove(); 66 $loginForm.find( '.login-email' ).removeClass( 'hidden' ).find( 'input' ).addClass( 'error' ); 67 }); 68 62 69 // If the form has data in it upon load, immediately trigger the validation. 63 70 if ( $loginForm.find('#user_login').val() ) { -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-create.php
r10964 r10981 51 51 } 52 52 53 if ( wporg_login_save_profile_fields( $pending_user ) ) {53 if ( wporg_login_save_profile_fields( $pending_user, 'create' ) ) { 54 54 // re-fetch the user, it's probably changed. 55 55 $pending_user = wporg_get_pending_user( $activation_user ); … … 149 149 <p class="login-login"> 150 150 <label for="user_login"><?php _e( 'Username', 'wporg' ); ?></label> 151 <input type="text" disabled="disabled" class=" 151 <input type="text" disabled="disabled" class="disabled" value="<?php echo esc_attr( $activation_user ); ?>" size="20" /> 152 152 </p> 153 153 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-profile.php
r10928 r10981 44 44 } 45 45 46 if ( wporg_login_save_profile_fields( $pending_user ) ) {46 if ( wporg_login_save_profile_fields( $pending_user, 'pending' ) ) { 47 47 // re-fetch the user, it's probably changed. 48 48 $pending_user = wporg_get_pending_user( $profile_user ); 49 49 } 50 50 wp_enqueue_script( 'wporg-registration' ); 51 52 // Allow changing the email, if they've not already changed it once. 53 $email_change_available = empty( $pending_user['meta']['changed_email'] ); 51 54 52 55 get_header(); … … 59 62 printf( 60 63 /* translators: %s Email address */ 61 __( 'Please check your email %s for a confirmation link to set your password.', 'wporg' ) . '<br>' . 62 '<a href="#" class="resend" data-account="%s">' . __( 'Resend confirmation email.', 'wporg' ) . '</a>', 64 __( 'Please check your email %s for a confirmation link to set your password.', 'wporg' ) . 65 '<br><br>' . '<a href="#" class="resend" data-account="%s">' . __( 'Resend confirmation email.', 'wporg' ) . '</a>' . 66 ( $email_change_available ? '<br>' . '<a href="#" class="change-email">' . __( 'Incorrect email? Update email address.', 'wporg' ) . '</a>' : '' ), 63 67 '<code>' . esc_html( $pending_user['user_email'] ) . '</code>', 64 68 esc_attr( $pending_user['user_email'] ) … … 67 71 printf( 68 72 /* 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' ), 73 __( 'Your account is pending approval. You will receive an email at %s to set your password when approved.', 'wporg' ) . 74 '<br>' . __( 'Please contact %s for more details.', 'wporg' ) . 75 ( $email_change_available ? '<br><br>' . '<a href="#" class="change-email">' . __( 'Incorrect email? Update email address.', 'wporg' ) . '</a>' : '' ), 71 76 '<code>' . esc_html( $pending_user['user_email'] ) . '</code>', 72 77 '<a href="mailto:' . $sso::SUPPORT_EMAIL . '">' . $sso::SUPPORT_EMAIL . '</a>' … … 83 88 <label for="user_login"><?php _e( 'Username', 'wporg' ); ?></label> 84 89 <input type="text" disabled="disabled" class=" disabled" value="<?php echo esc_attr( $profile_user ); ?>" size="20" /> 90 </p> 91 92 <p class="login-email hidden"> 93 <label for="user_email"><?php _e( 'Email', 'wporg' ); ?></label> 94 <input type="text" name="user_email" value="<?php echo esc_attr( $pending_user['user_email'] ); ?>" size="20" maxlength="100" /> 85 95 </p> 86 96 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/stylesheets/login.css
r10899 r10981 50 50 font-size: 14px; 51 51 } 52 52 .hidden, 53 53 #backtoblog { 54 54 display: none; … … 444 444 } 445 445 446 body.route-pending-profile .login-logininput.disabled,447 body.route-pending-create .login-logininput.disabled {446 body.route-pending-profile input.disabled, 447 body.route-pending-create input.disabled { 448 448 color: #666; 449 449 background: transparent;
Note: See TracChangeset
for help on using the changeset viewer.