diff --git src/wp-includes/class-wp-application-passwords.php src/wp-includes/class-wp-application-passwords.php
index 8ed02dd6f3..af4103529c 100644
|
|
|
class WP_Application_Passwords { |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $password['last_used'] = time(); |
| 350 | | $password['last_ip'] = $_SERVER['REMOTE_ADDR']; |
| | 350 | |
| | 351 | // Get remote IP address. |
| | 352 | $remote_addr = filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ); |
| | 353 | |
| | 354 | $password['last_ip'] = isset( $remote_addr ) ? $remote_addr : null; |
| 351 | 355 | |
| 352 | 356 | $saved = static::set_user_application_passwords( $user_id, $passwords ); |
| 353 | 357 | |
diff --git src/wp-includes/class-wp-session-tokens.php src/wp-includes/class-wp-session-tokens.php
index 9482e1b948..b5eb90ed49 100644
|
|
|
abstract class WP_Session_Tokens { |
| 129 | 129 | $session = apply_filters( 'attach_session_information', array(), $this->user_id ); |
| 130 | 130 | $session['expiration'] = $expiration; |
| 131 | 131 | |
| | 132 | // Get the IP address and user-agent. |
| | 133 | $remore_addr = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); |
| | 134 | |
| 132 | 135 | // IP address. |
| 133 | | if ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
| 134 | | $session['ip'] = $_SERVER['REMOTE_ADDR']; |
| | 136 | if ( ! empty( $remore_addr ) ) { |
| | 137 | $session['ip'] = $remore_addr; |
| 135 | 138 | } |
| 136 | 139 | |
| 137 | 140 | // User-agent. |
diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index a0b68759f9..592a4f21ad 100644
|
|
|
class WP_REST_Comments_Controller extends WP_REST_Controller { |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | if ( isset( $request['author_ip'] ) && ! current_user_can( 'moderate_comments' ) ) { |
| 498 | | if ( empty( $_SERVER['REMOTE_ADDR'] ) || $request['author_ip'] !== $_SERVER['REMOTE_ADDR'] ) { |
| | 498 | |
| | 499 | // Get remote IP address. |
| | 500 | $remote_addr = filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ); |
| | 501 | |
| | 502 | if ( empty( $remote_addr ) || $request['author_ip'] !== $remote_addr ) { |
| 499 | 503 | return new WP_Error( |
| 500 | 504 | 'rest_comment_invalid_author_ip', |
| 501 | 505 | /* translators: %s: Request parameter. */ |
| … |
… |
class WP_REST_Comments_Controller extends WP_REST_Controller { |
| 1300 | 1304 | protected function prepare_item_for_database( $request ) { |
| 1301 | 1305 | $prepared_comment = array(); |
| 1302 | 1306 | |
| | 1307 | // Get remote IP address. |
| | 1308 | $remote_addr = filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ); |
| | 1309 | |
| 1303 | 1310 | /* |
| 1304 | 1311 | * Allow the comment_content to be set via the 'content' or |
| 1305 | 1312 | * the 'content.raw' properties of the Request object. |
| … |
… |
class WP_REST_Comments_Controller extends WP_REST_Controller { |
| 1349 | 1356 | |
| 1350 | 1357 | if ( isset( $request['author_ip'] ) && current_user_can( 'moderate_comments' ) ) { |
| 1351 | 1358 | $prepared_comment['comment_author_IP'] = $request['author_ip']; |
| 1352 | | } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) && rest_is_ip_address( $_SERVER['REMOTE_ADDR'] ) ) { |
| 1353 | | $prepared_comment['comment_author_IP'] = $_SERVER['REMOTE_ADDR']; |
| | 1359 | } elseif ( ! empty( $remote_addr ) && rest_is_ip_address( $remote_addr ) ) { |
| | 1360 | $prepared_comment['comment_author_IP'] = $remote_addr; |
| 1354 | 1361 | } else { |
| 1355 | 1362 | $prepared_comment['comment_author_IP'] = '127.0.0.1'; |
| 1356 | 1363 | } |
diff --git src/wp-includes/user.php src/wp-includes/user.php
index 8d4aab98c1..77c1344094 100644
|
|
|
function retrieve_password( $user_login = '' ) { |
| 3303 | 3303 | $message .= network_site_url( 'wp-login.php?login=' . rawurlencode( $user_login ) . "&key=$key&action=rp", 'login' ) . '&wp_lang=' . $locale . "\r\n\r\n"; |
| 3304 | 3304 | |
| 3305 | 3305 | if ( ! is_user_logged_in() ) { |
| 3306 | | $requester_ip = $_SERVER['REMOTE_ADDR']; |
| | 3306 | // Get remote address. |
| | 3307 | $remote_addr = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); |
| | 3308 | |
| | 3309 | $requester_ip = isset( $remote_addr ) ? $remote_addr : ''; |
| 3307 | 3310 | if ( $requester_ip ) { |
| 3308 | 3311 | $message .= sprintf( |
| 3309 | 3312 | /* translators: %s: IP address of password reset requester. */ |