REST API: Improve validation for usernames and passwords.

Also improves the slashing of user data in the REST API to avoid data loss.

Props jnylen0.
Fixes #38739.


git-svn-id: https://develop.svn.wordpress.org/trunk@39219 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan McCue
2016-11-14 07:12:31 +00:00
parent 47a04c044d
commit ecb1e33d0d
3 changed files with 408 additions and 15 deletions

View File

@@ -161,3 +161,24 @@ function _upload_dir_https( $uploads ) {
return $uploads;
}
// Skip `setcookie` calls in auth_cookie functions due to warning:
// Cannot modify header information - headers already sent by ...
function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) {
$auth_cookie = null;
$expire = null;
$expiration = null;
$user_id = null;
$scheme = null;
/** This action is documented in wp-inclues/pluggable.php */
do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
$logged_in_cookie = null;
/** This action is documented in wp-inclues/pluggable.php */
do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
}
function wp_clear_auth_cookie() {
/** This action is documented in wp-inclues/pluggable.php */
do_action( 'clear_auth_cookie' );
}