From d5b1650e5e2d3d8a1e1d43a450776aff9c4e38e3 Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 18 Jan 2025 16:43:26 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20fix:=20=E4=BF=AE=E5=A4=8D=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E7=A1=AE=E8=AE=A4=E9=93=BE=E6=8E=A5=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LINGYUN/Abp/SettingManagement/Dto/ValueType.cs | 4 ++++ .../LINGYUN/Abp/Account/Emailing/AccountEmailSender.cs | 2 +- .../LINGYUN/Abp/Account/MyProfileAppService.cs | 10 ++++++++-- .../LINGYUN/Abp/SettingManagement/SettingAppService.cs | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs index 4ad54a458..000cc6c14 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs @@ -2,6 +2,10 @@ public enum ValueType { + /// + /// 不加入设置管理(配合前端请勿传递设置值) + /// + NoSet = -1, /// /// 字符 /// diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/Emailing/AccountEmailSender.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/Emailing/AccountEmailSender.cs index de699ed62..e14118a2c 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/Emailing/AccountEmailSender.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/Emailing/AccountEmailSender.cs @@ -66,7 +66,7 @@ public class AccountEmailSender : var url = await AppUrlProvider.GetUrlAsync(appName, AccountUrlNames.EmailConfirm); - var link = $"{url}?userId={user.Id}&{TenantResolverConsts.DefaultTenantKey}={user.TenantId}&confirmToken={UrlEncoder.Default.Encode(confirmToken)}"; + var link = $"{url}?userId={user.Id}&{TenantResolverConsts.DefaultTenantKey}={user.TenantId}&confirmToken={confirmToken}"; if (!returnUrl.IsNullOrEmpty()) { diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs index fc9e32a5f..0b77eb666 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs @@ -9,8 +9,11 @@ using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; +using System.Text.Encodings.Web; using System.Threading.Tasks; +using System.Web; using Volo.Abp; using Volo.Abp.Account.Localization; using Volo.Abp.Application.Dtos; @@ -165,11 +168,12 @@ public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppS } var token = await UserManager.GenerateEmailConfirmationTokenAsync(user); + var confirmToken = WebUtility.UrlEncode(token); var sender = LazyServiceProvider.LazyGetRequiredService(); await sender.SendEmailConfirmLinkAsync( user, - token, + confirmToken, input.AppName, input.ReturnUrl, input.ReturnUrlHash); @@ -181,7 +185,9 @@ public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppS var user = await UserManager.GetByIdAsync(CurrentUser.GetId()); - (await UserManager.ConfirmEmailAsync(user, input.ConfirmToken)).CheckErrors(); + // 字符编码错误 + var confirmToken = WebUtility.UrlDecode(input.ConfirmToken.Replace("%20", "%2B")); + (await UserManager.ConfirmEmailAsync(user, confirmToken)).CheckErrors(); await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext { diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs index 825061745..3c3a4b019 100644 --- a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs @@ -477,7 +477,7 @@ public class SettingAppService : ApplicationService, ISettingAppService, ISettin description: LocalizableString.Create("Description:Emailing.SendTestEmail")), StringLocalizerFactory, "", - ValueType.String, + ValueType.NoSet, providerName) .WithSlot("send-test-email") .RequiredPermission("SettingManagement.Emailing");