feat: 修改用户名效验
This commit is contained in:
@@ -248,6 +248,17 @@ namespace Yi.Framework.Rbac.Application.Services
|
|||||||
throw new UserFriendlyException("验证码错误");
|
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>
|
||||||
/// 注册,需要验证码通过
|
/// 注册,需要验证码通过
|
||||||
@@ -276,6 +287,10 @@ namespace Yi.Framework.Rbac.Application.Services
|
|||||||
{
|
{
|
||||||
throw new UserFriendlyException("密码需大于等于6位!");
|
throw new UserFriendlyException("密码需大于等于6位!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//效验用户名
|
||||||
|
ValidateUserName(input);
|
||||||
|
|
||||||
//效验验证码,根据电话号码获取 value,比对验证码已经uuid
|
//效验验证码,根据电话号码获取 value,比对验证码已经uuid
|
||||||
await ValidationPhoneCaptchaAsync(input);
|
await ValidationPhoneCaptchaAsync(input);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user