修改用户名正则

This commit is contained in:
wanggeng888 2021-05-01 12:03:31 +08:00
parent 6026def180
commit a9af60de1e
2 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ public class RegexUtil {
/**
* 用户名
*/
private static final Pattern PATTERN_USERNAME = Pattern.compile("^[a-zA-Z0-9_\\s]+$");
private static final Pattern PATTERN_USERNAME = Pattern.compile("^[a-zA-Z0-9\\-\\_\\!\\@\\#\\%\\.]+$");
/**
* 字母
*/

View File

@ -213,7 +213,7 @@ public class ApiParamsAspect {
}
if (StringUtils.equals("username", verifyType)) {
if (!RegexUtil.isUsername(value)) {
throw new ParamsException(String.format("%s格式只能是字母、数字和下划线", name));
throw new ParamsException(String.format("%s格式只能包含字母、数字、-_!@#%.", name));
}
return;
} else if (StringUtils.equals("phone", verifyType)) {