From c2290f95cf3228422351c54a2876707bbe5c3c9a Mon Sep 17 00:00:00 2001 From: chenchun Date: Fri, 25 Oct 2024 17:36:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Account/WeChatMiniProgramAccountService.cs | 2 +- .../Yi.Framework.Rbac.Application/Services/AccountService.cs | 4 ++-- .../rbac/Yi.Framework.Rbac.Domain/Managers/UserManager.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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("用户名不能包含除【字母】与【数字】与【_】的其他字符"); } }