X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/72836ec95a52eacbda4dc5aa296b7dd6de08bd3b..245e789b234afa4525862e7a6e5e3c2e7a52ef20:/wp-login.php
diff --git a/wp-login.php b/wp-login.php
index 042f29a8..0197167f 100644
--- a/wp-login.php
+++ b/wp-login.php
@@ -30,8 +30,8 @@ if ( force_ssl_admin() && ! is_ssl() ) {
* @param string $wp_error Optional. The error to pass. Default empty.
* @param WP_Error $wp_error Optional. WordPress Error Object
*/
-function login_header($title = 'Log In', $message = '', $wp_error = '') {
- global $error, $interim_login, $current_site, $action;
+function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
+ global $error, $interim_login, $action;
// Don't index any of these forms
add_action( 'login_head', 'wp_no_robots' );
@@ -57,14 +57,18 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
add_action( 'login_head', 'wp_shake_js', 12 );
?>
- >
+
+
+ >
+
›
site_name;
+ $login_header_title = get_current_site()->site_name;
} else {
- $login_header_url = __( 'http://wordpress.org/' );
+ $login_header_url = __( 'https://wordpress.org/' );
$login_header_title = __( 'Powered by WordPress' );
}
@@ -127,6 +131,7 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
if ( 'success' === $interim_login )
$classes[] = 'interim-login-success';
}
+ $classes[] =' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
/**
* Filter the login page body classes.
@@ -262,7 +267,7 @@ function wp_login_viewport_meta() {
* @return bool|WP_Error True: when finish. WP_Error on error
*/
function retrieve_password() {
- global $wpdb, $current_site, $wp_hasher;
+ global $wpdb, $wp_hasher;
$errors = new WP_Error();
@@ -299,8 +304,8 @@ function retrieve_password() {
/**
* Fires before a new password is retrieved.
*
- * @since 1.5.2
- * @deprecated 1.5.2 Misspelled. Use 'retrieve_password' hook instead.
+ * @since 1.5.0
+ * @deprecated 1.5.1 Misspelled. Use 'retrieve_password' hook instead.
*
* @param string $user_login The user login name.
*/
@@ -308,7 +313,7 @@ function retrieve_password() {
/**
* Fires before a new password is retrieved.
*
- * @since 1.5.2
+ * @since 1.5.1
*
* @param string $user_login The user login name.
*/
@@ -384,7 +389,7 @@ function retrieve_password() {
*/
$message = apply_filters( 'retrieve_password_message', $message, $key );
- if ( $message && !wp_mail($user_email, $title, $message) )
+ if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
wp_die( __('The e-mail could not be sent.') . "
\n" . __('Possible reason: your host may have disabled the mail() function.') );
return true;
@@ -508,7 +513,7 @@ case 'retrievepassword' :
/**
* Fires before the lost password form.
*
- * @since 1.5.2
+ * @since 1.5.1
*/
do_action( 'lost_password' );
@@ -542,7 +547,7 @@ if ( get_option( 'users_can_register' ) ) :
/**
* Filter the registration URL below the login form.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $registration_url Registration URL.
*/
@@ -557,10 +562,25 @@ break;
case 'resetpass' :
case 'rp' :
- $user = check_password_reset_key($_GET['key'], $_GET['login']);
+ list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
+ $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
+ if ( isset( $_GET['key'] ) ) {
+ $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) );
+ setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
+ wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
+ exit;
+ }
+
+ 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;
+ }
- if ( is_wp_error($user) ) {
- if ( $user->get_error_code() === 'expired_key' )
+ if ( ! $user || is_wp_error( $user ) ) {
+ setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
+ if ( $user && $user->get_error_code() === 'expired_key' )
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
else
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
@@ -584,6 +604,7 @@ case 'rp' :
if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
reset_password($user, $_POST['pass1']);
+ setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
login_header( __( 'Password Reset' ), '' . __( 'Your password has been reset.' ) . ' ' . __( 'Log in' ) . '
' );
login_footer();
exit;
@@ -595,8 +616,8 @@ case 'rp' :
login_header(__('Reset Password'), '' . __('Enter your new password below.') . '
', $errors );
?>
-
@@ -740,11 +772,18 @@ default:
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
$secure_cookie = false;
- // If cookies are disabled we can't log in even with a valid user+pass
- if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
- $user = new WP_Error('test_cookie', __("ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress."));
- else
- $user = wp_signon('', $secure_cookie);
+ $user = wp_signon( '', $secure_cookie );
+
+ if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
+ if ( headers_sent() ) {
+ $user = new WP_Error( 'test_cookie', sprintf( __( 'ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums.' ),
+ __( 'http://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
+ } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
+ // If cookies are disabled we can't log in even with a valid user+pass
+ $user = new WP_Error( 'test_cookie', sprintf( __( 'ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.' ),
+ __( 'http://codex.wordpress.org/Cookies' ) ) );
+ }
+ }
$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
/**