Changeset 9146 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-profile.php
- Timestamp:
- 09/23/2019 03:52:23 AM (6 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-profile.php
r9139 r9146 1 1 <?php 2 2 /** 3 * The post- registerprofile-fields Template3 * The post-pending-email-confirm profile-fields Template 4 4 * 5 5 * @package wporg-login 6 6 */ 7 7 8 $profile_user = isset( WP_WPOrg_SSO::$matched_route_params['profile_user'] ) ? WP_WPOrg_SSO::$matched_route_params['profile_user'] : false; 9 $profile_nonce = isset( WP_WPOrg_SSO::$matched_route_params['profile_nonce'] ) ? WP_WPOrg_SSO::$matched_route_params['profile_nonce'] : false; 8 $profile_user = WP_WPOrg_SSO::$matched_route_params['profile_user'] ?? false; 9 $profile_key = WP_WPOrg_SSO::$matched_route_params['profile_key'] ?? false; 10 11 $pending_user = wporg_get_pending_user( $profile_user ); 10 12 11 13 $can_access = false; 12 if ( 13 $profile_user && $profile_nonce && 14 ( $user = get_user_by( 'login', $profile_user ) ) && 15 $user->exists() 16 ) { 17 wp_set_current_user( $user->ID ); 18 $can_access = wp_verify_nonce( $profile_nonce, 'login-register-profile-edit' ); 14 if ( $pending_user && $pending_user['user_profile_key'] ) { 15 $expiration_duration = DAY_IN_SECONDS; // The profile-edit screen is short lived. 16 17 list( $user_request_time, $hashed_profile_key ) = explode( ':', $pending_user['user_profile_key'], 2 ); 18 $expiration_time = $user_request_time + $expiration_duration; 19 20 $hash_is_correct = wp_check_password( $profile_key, $hashed_profile_key ); 21 22 if ( $hash_is_correct && time() < $expiration_time ) { 23 $can_access = true; 24 } 19 25 } 20 26 21 if ( ! $can_access ) { 22 wp_set_current_user( 0 ); 27 if ( $can_access && $pending_user['created'] ) { 28 wp_safe_redirect( 'https://wordpress.org/support/' ); 29 die(); 30 } elseif ( ! $can_access ) { 23 31 wp_safe_redirect( '/' ); 24 32 die(); 25 33 } 26 34 27 wporg_login_save_profile_fields(); 28 35 if ( wporg_login_save_profile_fields( $pending_user ) ) { 36 // re-fetch the user, it's probably changed. 37 $pending_user = wporg_get_pending_user( $profile_user ); 38 } 29 39 wp_enqueue_script( 'wporg-registration' ); 30 40 … … 47 57 <form name="registerform" id="registerform" action="" method="post"> 48 58 49 <?php include __DIR__ . '/partials/register-profilefields.php'; ?> 59 <?php 60 $fields = &$pending_user['meta']; 61 include __DIR__ . '/partials/register-profilefields.php'; 62 ?> 50 63 51 64 <p class="login-submit">
Note: See TracChangeset
for help on using the changeset viewer.