mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-02 04:57:16 +08:00
refactor: 优化密码策略处理
This commit is contained in:
@@ -66,6 +66,11 @@ public class CacheConstants {
|
||||
*/
|
||||
public static final String DASHBOARD_KEY_PREFIX = "DASHBOARD" + DELIMITER;
|
||||
|
||||
/**
|
||||
* 用户密码错误次数缓存键前缀
|
||||
*/
|
||||
public static final String USER_PASSWORD_ERROR_KEY_PREFIX = USER_KEY_PREFIX + "PASSWORD_ERROR" + DELIMITER;
|
||||
|
||||
private CacheConstants() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,27 +25,32 @@ package top.continew.admin.common.constant;
|
||||
public class RegexConstants {
|
||||
|
||||
/**
|
||||
* 用户名正则(长度为 4 到 64 位,可以包含字母、数字,下划线,以字母开头)
|
||||
* 用户名正则(用户名长度为 4-64 个字符,支持大小写字母、数字、下划线,以字母开头)
|
||||
*/
|
||||
public static final String USERNAME = "^[a-zA-Z][a-zA-Z0-9_]{3,64}$";
|
||||
|
||||
/**
|
||||
* 密码正则(长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字)
|
||||
* 密码正则模板(密码长度为 min-max 个字符,支持大小写字母、数字、特殊字符,至少包含字母和数字)
|
||||
*/
|
||||
public static final String PASSWORD = "^(?=.*\\d)(?=.*[a-z]).{6,32}$";
|
||||
public static final String PASSWORD_TEMPLATE = "^(?=.*\\d)(?=.*[a-z]).{%s,%s}$";
|
||||
|
||||
/**
|
||||
* 密码正则严格版(长度为 8 到 32 位,包含至少1个大写字母、1个小写字母、1个数字,1个特殊字符)
|
||||
* 密码正则(密码长度为 8-32 个字符,支持大小写字母、数字、特殊字符,至少包含字母和数字)
|
||||
*/
|
||||
public static final String PASSWORD_STRICT = "^\\S*(?=\\S{8,32})(?=\\S*\\d)(?=\\S*[A-Z])(?=\\S*[a-z])(?=\\S*[!@#$%^&*? ])\\S*$";
|
||||
public static final String PASSWORD = "^(?=.*\\d)(?=.*[a-z]).{8,32}$";
|
||||
|
||||
/**
|
||||
* 通用编码正则(长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头)
|
||||
* 特殊字符正则
|
||||
*/
|
||||
public static final String SPECIAL_CHARACTER = "[-_`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\\n|\\r|\\t";
|
||||
|
||||
/**
|
||||
* 通用编码正则(长度为 2-30 个字符,支持大小写字母、数字、下划线,以字母开头)
|
||||
*/
|
||||
public static final String GENERAL_CODE = "^[a-zA-Z][a-zA-Z0-9_]{1,29}$";
|
||||
|
||||
/**
|
||||
* 通用名称正则(长度为 2 到 30 位,可以包含中文、字母、数字、下划线,短横线)
|
||||
* 通用名称正则(长度为 2-30 个字符,支持中文、字母、数字、下划线,短横线)
|
||||
*/
|
||||
public static final String GENERAL_NAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{2,30}$";
|
||||
|
||||
|
||||
@@ -24,6 +24,16 @@ package top.continew.admin.common.constant;
|
||||
*/
|
||||
public class SysConstants {
|
||||
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
public static final Integer NO = 0;
|
||||
|
||||
/**
|
||||
* 是
|
||||
*/
|
||||
public static final Integer YES = 1;
|
||||
|
||||
/**
|
||||
* 管理员角色编码
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user