feat: 用户account领域与user领域关系

This commit is contained in:
陈淳
2024-04-29 14:22:45 +08:00
parent df5224cf12
commit cabdd55cf5
4 changed files with 99 additions and 87 deletions

View File

@@ -203,18 +203,6 @@ namespace Yi.Framework.Rbac.Application.Services
throw new UserFriendlyException("验证码错误");
}
private void ValidateUserName(RegisterDto input)
{
// 正则表达式,匹配只包含数字和字母的字符串
string pattern = @"^[a-zA-Z0-9]+$";
bool isMatch = Regex.IsMatch(input.UserName, pattern);
if (!isMatch)
{
throw new UserFriendlyException("用户名不能包含除【字母】与【数字】的其他字符");
}
}
/// <summary>
/// 注册,需要验证码通过
/// </summary>
@@ -228,28 +216,9 @@ namespace Yi.Framework.Rbac.Application.Services
{
throw new UserFriendlyException("该系统暂未开放注册功能");
}
if (input.UserName == UserConst.Admin)
{
throw new UserFriendlyException("用户名无效注册!");
}
if (input.UserName.Length < 2)
{
throw new UserFriendlyException("账号名需大于等于2位");
}
if (input.Password.Length < 6)
{
throw new UserFriendlyException("密码需大于等于6位");
}
//校验用户名
ValidateUserName(input);
//校验验证码,根据电话号码获取 value比对验证码已经uuid
await ValidationPhoneCaptchaAsync(input);
//注册领域逻辑
await _accountManager.RegisterAsync(input.UserName, input.Password, input.Phone);
}