diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xsd b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN.Abp.Account.Security.Aliyun.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN.Abp.Account.Security.Aliyun.csproj new file mode 100644 index 000000000..6171d68a8 --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN.Abp.Account.Security.Aliyun.csproj @@ -0,0 +1,21 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0;net9.0 + LINGYUN.Abp.Account.Security.Aliyun + LINGYUN.Abp.Account.Security.Aliyun + false + false + false + + + + + + + + + diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AbpAccountSecurityAliyunModule.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AbpAccountSecurityAliyunModule.cs new file mode 100644 index 000000000..fdf5d3b2f --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AbpAccountSecurityAliyunModule.cs @@ -0,0 +1,11 @@ +using LINGYUN.Abp.Sms.Aliyun; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Account.Security.Aliyun; + +[DependsOn( + typeof(AbpAccountSecurityModule), + typeof(AbpAliyunSmsModule))] +public class AbpAccountSecurityAliyunModule : AbpModule +{ +} diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AliyunAccountSmsSecurityCodeSender.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AliyunAccountSmsSecurityCodeSender.cs new file mode 100644 index 000000000..8d9517194 --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AliyunAccountSmsSecurityCodeSender.cs @@ -0,0 +1,32 @@ +using LINGYUN.Abp.Sms.Aliyun; +using Microsoft.Extensions.DependencyInjection; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Account.Security.Aliyun; + +[Dependency(ServiceLifetime.Transient, ReplaceServices = true)] +[ExposeServices(typeof(IAccountSmsSecurityCodeSender), typeof(AliyunAccountSmsSecurityCodeSender))] +public class AliyunAccountSmsSecurityCodeSender : IAccountSmsSecurityCodeSender +{ + protected IAliyunSmsVerifyCodeSender SmsVerifyCodeSender { get; } + public AliyunAccountSmsSecurityCodeSender( + IAliyunSmsVerifyCodeSender smsVerifyCodeSender) + { + SmsVerifyCodeSender = smsVerifyCodeSender; + } + + public async virtual Task SendAsync( + string phone, + string code, + string templateCode, + CancellationToken cancellation = default) + { + // TODO: 传递验证码有效期 + await SmsVerifyCodeSender.SendAsync( + new SmsVerifyCodeMessage(phone, + new SmsVerifyCodeMessageParam(code, "5"), + templateCode: templateCode)); + } +}