diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs index 192dc0ba..e5435451 100644 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs +++ b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs @@ -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}" }); diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs index e20527e4..70ff2df4 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs @@ -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); diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Managers/UserManager.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Managers/UserManager.cs index a4723df7..cb057052 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Managers/UserManager.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Managers/UserManager.cs @@ -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("用户名不能包含除【字母】与【数字】与【_】的其他字符"); } }