From 161766d0a2fd72b653b7fa5762c2ddffed044d9b Mon Sep 17 00:00:00 2001
From: "T.Todua" <7117978+ttodua@users.noreply.github.com>
Date: Thu, 9 Apr 2020 20:43:30 +0400
Subject: [PATCH] update
---
src/wp-includes/functions.php | 13 +++++++++++++
src/wp-login.php | 10 ++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index bc9f276b89..b38ce41abd 100644
a
|
b
|
function wp_auth_check( $response ) { |
6540 | 6540 | return $response; |
6541 | 6541 | } |
6542 | 6542 | |
| 6543 | /** |
| 6544 | * Check whether user registration is disabled and password reset is also disabled |
| 6545 | * for existing users, and in this case, redirects to login page. |
| 6546 | * |
| 6547 | * @since 5.4.0 |
| 6548 | */ |
| 6549 | function wp_redirect_if_disabled_registration_and_reset() { |
| 6550 | if ( !get_option( 'users_can_register' ) && ! apply_filters( 'allow_password_reset_for_existing_users', true ) ) { |
| 6551 | wp_safe_redirect( 'wp-login.php' ); |
| 6552 | exit(); |
| 6553 | } |
| 6554 | } |
| 6555 | |
6543 | 6556 | /** |
6544 | 6557 | * Return RegEx body to liberally match an opening HTML tag. |
6545 | 6558 | * |
diff --git a/src/wp-login.php b/src/wp-login.php
index 0b552ef326..b471822621 100644
a
|
b
|
switch ( $action ) { |
801 | 801 | |
802 | 802 | case 'lostpassword': |
803 | 803 | case 'retrievepassword': |
| 804 | wp_redirect_if_disabled_registration_and_reset(); |
| 805 | |
804 | 806 | if ( $http_post ) { |
805 | 807 | $errors = retrieve_password(); |
806 | 808 | |
… |
… |
switch ( $action ) { |
893 | 895 | |
894 | 896 | case 'resetpass': |
895 | 897 | case 'rp': |
| 898 | wp_redirect_if_disabled_registration_and_reset(); |
| 899 | |
896 | 900 | list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
897 | 901 | $rp_cookie = 'wp-resetpass-' . COOKIEHASH; |
898 | 902 | |
… |
… |
switch ( $action ) { |
1362 | 1366 | ?> |
1363 | 1367 | |
1364 | 1368 | <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
1365 | | <p> |
| 1369 | <p class="username-email"> |
1366 | 1370 | <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
1367 | 1371 | <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /> |
1368 | 1372 | </p> |
… |
… |
switch ( $action ) { |
1430 | 1434 | } |
1431 | 1435 | |
1432 | 1436 | ?> |
1433 | | <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
| 1437 | <?php if ( get_option( 'users_can_register' ) || apply_filters( 'allow_password_reset_for_existing_users', true ) ) : ?> |
| 1438 | <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
| 1439 | <?php endif; ?> |
1434 | 1440 | <?php |
1435 | 1441 | } |
1436 | 1442 | |