admin管理员组文章数量:1323519
I'm using the Wordpress's built-in forgot password reset form and views.
I want to limit the number of reset password email attempts. By default Wordpress allows you to send unlimited reset password emails and I want to set a limit. How can I do?
This feature is only available in the Wordfence security plugin. I don't want to use Wordfence. I searched for other plugins but could not find them. I can actually write code. You can write a suggestion.
I'm using the Wordpress's built-in forgot password reset form and views.
I want to limit the number of reset password email attempts. By default Wordpress allows you to send unlimited reset password emails and I want to set a limit. How can I do?
This feature is only available in the Wordfence security plugin. I don't want to use Wordfence. I searched for other plugins but could not find them. I can actually write code. You can write a suggestion.
Share Improve this question asked Sep 7, 2020 at 7:27 Mert VAROLMert VAROL 235 bronze badges1 Answer
Reset to default 0You need put the attempts on user meta, then do check every time user hit reset passwords.
add_action( 'password_reset', 'my_password_reset', 10, 2 );
function my_password_reset( $user, $new_pass ) {
$limit=5;// Set the limit here
$attempts=(int) get_user_meta($user->ID,"reset_attempts",true);
if($attempts>$limit){
//Do something in here, example redirect to warning page.
wp_redirect( "/warning" );
exit;
}
update_user_meta($user->ID,"reset_attempts",$attempts++);
}
本文标签: phpHow to limit the number of forgot password reset attempts in Wordpress
版权声明:本文标题:php - How to limit the number of forgot password reset attempts in Wordpress? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742134097a2422292.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论