更改WooCommerce默认密码安全级别 [英] Change WooCommerce default password security level

查看:101
本文介绍了更改WooCommerce默认密码安全级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改WooCommerce注册表单的最小密码强度,我无法做很多事情.

I am trying to change the WooCommerce Registration form minimum password strength and I am unable to do much.

任何人都可以分享一种解决方案,通过它我可以修改最小密码强度,并允许用户使用长度为7个字符且其中不需要任何符号或大写字母的密码?

Can anyone please share a solution by which I can amend the minimum password strength and allow users to user a password that's 7 characters long and does not need any symbols or capital letters inside it?

谢谢.

推荐答案

当前唯一的钩子设置是 woocommerce_min_password_strength 过滤器钩子.因此,您可以设置自定义挂钩函数并降低此强度.有4种可能的设置:

The only existing hook setting for that is woocommerce_min_password_strength filter hook. So you can set a custom hook function and lowering this strenght. There is 4 possible settings:

  • 3 =>强(默认)
  • 2 =>中
  • 1 =>弱
  • 0 =>非常弱(任何东西).

这是代码:

add_filter( 'woocommerce_min_password_strength', 'reduce_min_strength_password_requirement' );
function reduce_min_strength_password_requirement( $strength ) {
    // 3 => Strong (default) | 2 => Medium | 1 => Weak | 0 => Very Weak (anything).
    return 2; 
}

代码会出现在您活动的子主题(或主题)的function.php文件中,也可能会出现在任何插件文件中.

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

此代码已经过测试并且可以正常工作.

This code is tested and works.

所有其他解决方案将是复杂的,而且是真正的发展.

All other solutions will be complicated and a real development.

这篇关于更改WooCommerce默认密码安全级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆