fix: password strength

This commit is contained in:
王瑜 2021-01-30 13:53:39 +08:00
parent 76d9ed3f0a
commit ddb43cdf58
2 changed files with 2 additions and 2 deletions

View File

@ -19,6 +19,6 @@ public class UserPasswordDto {
private String oldPassword;
@NotBlank(message = "新密码不可为空!")
@Pattern(regexp = StrengthUtils.PATTERN, message = "密码强度不够,至少应该包含数字、大小写字母、符号组合!")
@Pattern(regexp = StrengthUtils.PATTERN, message = "密码强度不够,12-18位至少应该包含数字、大小写字母、符号组合!")
private String password;
}

View File

@ -9,7 +9,7 @@ import java.util.regex.Pattern;
*/
public abstract class StrengthUtils {
public static final String PATTERN = "^(?![a-zA-z]+$)(?!\\d+$)(?![,.!?~`_+=@#$%^&*;<>':]+$)(?![a-zA-z\\d]+$)(?![a-zA-z,.!?~`_+=@#$%^&*;<>':]+$)(?![\\d,.!?~`_+=@#$%^&*;<>':]+$)[a-zA-Z\\d,.!?~`_+=@#$%^&*;<>':]{8,16}$";
public static final String PATTERN = "^(?![a-zA-z]+$)(?!\\d+$)(?![,.!?~`_+=@#$%^&*;<>':]+$)(?![a-zA-z\\d]+$)(?![a-zA-z,.!?~`_+=@#$%^&*;<>':]+$)(?![\\d,.!?~`_+=@#$%^&*;<>':]+$)[a-zA-Z\\d,.!?~`_+=@#$%^&*;<>':]{12,18}$";
/**
* 此处传入密码明文判定密码可用性