Browse Source

feat(account): Alibaba Cloud SMS Security Code module

pull/1363/head
colin 3 months ago
parent
commit
8a2968b8e3
  1. 3
      aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xml
  2. 30
      aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xsd
  3. 21
      aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN.Abp.Account.Security.Aliyun.csproj
  4. 11
      aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AbpAccountSecurityAliyunModule.cs
  5. 32
      aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN/Abp/Account/Security/Aliyun/AliyunAccountSmsSecurityCodeSender.cs

3
aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

21
aspnet-core/modules/account/LINGYUN.Abp.Account.Security.Aliyun/LINGYUN.Abp.Account.Security.Aliyun.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0</TargetFrameworks>
<AssemblyName>LINGYUN.Abp.Account.Security.Aliyun</AssemblyName>
<PackageId>LINGYUN.Abp.Account.Security.Aliyun</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Account.Security\LINGYUN.Abp.Account.Security.csproj" />
</ItemGroup>
</Project>

11
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
{
}

32
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));
}
}
Loading…
Cancel
Save