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

查看:33
本文介绍了更改 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天全站免登陆