admin管理员组文章数量:1122832
Would like to find out if there is any way I could customize the wp_login page to remove the "There is no account with that username or email address." validation (show below)
and any email/username entered are all redirected to this check email page instead?
I understand making change to wp-login.php is not advisable.
Seeking experts here for recommendation and advise.
Thanks in advance!
Would like to find out if there is any way I could customize the wp_login page to remove the "There is no account with that username or email address." validation (show below)
and any email/username entered are all redirected to this check email page instead?
I understand making change to wp-login.php is not advisable.
Seeking experts here for recommendation and advise.
Thanks in advance!
- if sending a confirmation link is possible then that first screen should be impossible, can you explain the problem that this would solve for you? Doing this would have negative security consequences as it would be possible to list unconfirmed users for exploitation – Tom J Nowell ♦ Commented Nov 15, 2021 at 10:01
- Hi Tom, my intention of removing this email check validation is to prevent user enumeration attacks. Without this validation in place, there is no longer a "hint" made known to an attacker to guess or confirm if the email entered is a valid account to my WP portal. – BBBBB86 Commented Nov 16, 2021 at 0:47
- Do you mean that if I disable the validation check, the confirmation link will be sent out regardless the email entered is a valid or a non-existing account in my portal? I think this can be customized on the PHP end to prevent that right? – BBBBB86 Commented Nov 16, 2021 at 1:01
- I believe I misunderstood – Tom J Nowell ♦ Commented Aug 14, 2023 at 9:14
1 Answer
Reset to default 0On a successful lost password email send, Wordpress forwards to the login page with the query string ?checkemail=confirm
. So we can happily just manually redirect to this page when we evaluate that the lostpassword form is being shown after the user made a post request. Then we can update the confirmation text to suit our needs.
add_action( 'lost_password', 'prevent_lost_password_enumeration', 10, 1 );
add_filter( 'gettext', 'change_lost_password_email_sent_notice', 10, 3 );
function prevent_lost_password_enumeration($errors) {
$http_post = 'POST' === $_SERVER['REQUEST_METHOD'];
if (!$http_post) return;
//Allow an empty message to show
if (empty(trim(strval($_POST['user_login'] ?? '')))) return;
$redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
wp_safe_redirect($redirect_to);
exit;
}
public function change_lost_password_email_sent_notice($translated_text, $text, $domain) {
$default = 'Check your email for the confirmation link, then visit the <a href="%s">login page</a>.';
if ($default !== $text) return $translated_text;
$new = 'If your email address exists in our system, we have sent you an email with instructions to reset your password';
return esc_html($new);
}
本文标签:
版权声明:本文标题:customization - Removing "There is no account with that username or email address." error message in " 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736294417a1929352.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论