Correctly set the secure
flag on the post password cookie based on the scheme of the referring URL, if it's available, instead of the home URL.
Fixes #29641 git-svn-id: https://develop.svn.wordpress.org/trunk@34932 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
855991c578
commit
9b156ee2a9
@ -440,7 +440,12 @@ case 'postpass' :
|
||||
* @param int $expires The expiry time, as passed to setcookie().
|
||||
*/
|
||||
$expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
|
||||
$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
|
||||
$referer = wp_get_referer();
|
||||
if ( $referer ) {
|
||||
$secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) );
|
||||
} else {
|
||||
$secure = false;
|
||||
}
|
||||
setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
|
||||
|
||||
wp_safe_redirect( wp_get_referer() );
|
||||
|
Loading…
Reference in New Issue
Block a user