feat: 兼容支持用户名_

This commit is contained in:
chenchun
2024-10-25 17:36:23 +08:00
parent 6eb72c0303
commit c2290f95cf
3 changed files with 5 additions and 5 deletions

View File

@@ -152,12 +152,12 @@ namespace Yi.Framework.Rbac.Domain.Managers
}
// 正则表达式,匹配只包含数字和字母的字符串
string pattern = @"^[a-zA-Z0-9]+$";
string pattern = @"^[a-zA-Z0-9_]+$";
bool isMatch = Regex.IsMatch(input.UserName, pattern);
if (!isMatch)
{
throw new UserFriendlyException("用户名不能包含除【字母】与【数字】的其他字符");
throw new UserFriendlyException("用户名不能包含除【字母】与【数字】与【_】的其他字符");
}
}