Avoid PHP notices in wp-login.php if password reset cookie is not set.
props mdawaffe. see #29060. git-svn-id: https://develop.svn.wordpress.org/trunk@29381 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0f01ebb037
commit
31105be6c7
|
@ -568,13 +568,16 @@ case 'rp' :
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
|
if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
|
||||||
|
list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
|
||||||
|
$user = check_password_reset_key( $rp_key, $rp_login );
|
||||||
|
} else {
|
||||||
|
$user = false;
|
||||||
|
}
|
||||||
|
|
||||||
$user = check_password_reset_key( $rp_key, $rp_login );
|
if ( ! $user || is_wp_error( $user ) ) {
|
||||||
|
|
||||||
if ( is_wp_error($user) ) {
|
|
||||||
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
|
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
|
||||||
if ( $user->get_error_code() === 'expired_key' )
|
if ( $user && $user->get_error_code() === 'expired_key' )
|
||||||
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
|
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
|
||||||
else
|
else
|
||||||
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
|
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
|
||||||
|
|
Loading…
Reference in New Issue