feat: 兼容支持用户名_
This commit is contained in:
@@ -110,7 +110,7 @@ public class WeChatMiniProgramAccountService : ApplicationService
|
||||
var userName = GenerateRandomString(6);
|
||||
await _accountService.PostTempRegisterAsync(new RegisterDto
|
||||
{
|
||||
UserName =$"ls-{userName}",
|
||||
UserName =$"ls_{userName}",
|
||||
Password = GenerateRandomString(20),
|
||||
Nick = $"临时账号-{userName}"
|
||||
});
|
||||
|
||||
@@ -324,9 +324,9 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
}
|
||||
|
||||
//临时账号
|
||||
if (input.UserName.StartsWith("ls-"))
|
||||
if (input.UserName.StartsWith("ls_"))
|
||||
{
|
||||
throw new UserFriendlyException("注册账号不能以ls-字符开头");
|
||||
throw new UserFriendlyException("注册账号不能以ls_字符开头");
|
||||
}
|
||||
//注册领域逻辑
|
||||
await _accountManager.RegisterAsync(input.UserName, input.Password, input.Phone, input.Nick);
|
||||
|
||||
@@ -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("用户名不能包含除【字母】与【数字】与【_】的其他字符");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user