From 6226af307bf17df7eaefe6b2cd87a24a1465fb1b Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Wed, 27 Apr 2016 05:55:27 +0000 Subject: [PATCH] Users: Prevent spammy users from resetting their passwords in multisite Props r-a-y, websupporter. Fixes #24617. Built from https://develop.svn.wordpress.org/trunk@37317 git-svn-id: http://core.svn.wordpress.org/trunk@37283 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 7 ++++++- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index 48c6e84f4a..4ac9fe93b9 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -2036,6 +2036,11 @@ function get_password_reset_key( $user ) { */ do_action( 'retrieve_password', $user->user_login ); + $allow = true; + if ( is_multisite() && is_user_spammy( $user ) ) { + $allow = false; + } + /** * Filter whether to allow a password to be reset. * @@ -2044,7 +2049,7 @@ function get_password_reset_key( $user ) { * @param bool $allow Whether to allow the password to be reset. Default true. * @param int $user_data->ID The ID of the user attempting to reset a password. */ - $allow = apply_filters( 'allow_password_reset', true, $user->ID ); + $allow = apply_filters( 'allow_password_reset', $allow, $user->ID ); if ( ! $allow ) { return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 49697f07d1..e814635356 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37316'; +$wp_version = '4.6-alpha-37317'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.